#include "base/basictypes.h"
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
+#include "components/history/core/browser/history_service_observer.h"
+#include "components/history/core/browser/keyword_id.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+class HistoryService;
class Profile;
namespace base {
struct URLsDeletedDetails;
struct URLsModifiedDetails;
-class InMemoryHistoryBackend : public content::NotificationObserver {
+class InMemoryHistoryBackend : public HistoryServiceObserver,
+ public content::NotificationObserver {
public:
InMemoryHistoryBackend();
- virtual ~InMemoryHistoryBackend();
+ ~InMemoryHistoryBackend() override;
// Initializes the backend from the history database pointed to by the
- // full path in |history_filename|. |db| is used for setting up the
- // InMemoryDatabase.
- bool Init(const base::FilePath& history_filename, URLDatabase* db);
+ // full path in |history_filename|.
+ bool Init(const base::FilePath& history_filename);
// Does initialization work when this object is attached to the history
// system on the main thread. The argument is the profile with which the
// attached history service is under.
- void AttachToHistoryService(Profile* profile);
+ void AttachToHistoryService(Profile* profile,
+ HistoryService* history_service);
+
+ // Deletes all search terms for the specified keyword.
+ void DeleteAllSearchTermsForKeyword(KeywordID keyword_id);
// Returns the underlying database associated with this backend. The current
// autocomplete code was written fro this, but it should probably be removed
return db_.get();
}
+ // HistoryServiceObserver:
+ void OnURLVisited(HistoryService* history_service,
+ ui::PageTransition transition,
+ const URLRow& row,
+ const RedirectList& redirects,
+ base::Time visit_time) override;
+
// Notification callback.
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE;
+ void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) override;
private:
FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, DeleteAll);
// The profile that this object is attached. May be NULL before
// initialization.
Profile* profile_;
+ HistoryService* history_service_;
DISALLOW_COPY_AND_ASSIGN(InMemoryHistoryBackend);
};