Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / history / in_memory_history_backend.h
index 3706993..793d9d6 100644 (file)
 #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 {
@@ -44,20 +47,24 @@ class URLRow;
 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
@@ -66,10 +73,17 @@ class InMemoryHistoryBackend : public content::NotificationObserver {
     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);
@@ -93,6 +107,7 @@ class InMemoryHistoryBackend : public content::NotificationObserver {
   // The profile that this object is attached. May be NULL before
   // initialization.
   Profile* profile_;
+  HistoryService* history_service_;
 
   DISALLOW_COPY_AND_ASSIGN(InMemoryHistoryBackend);
 };