Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4936)

Unified Diff: chrome/browser/android/provider/chrome_browser_provider.h

Issue 651193002: Remove NOTIFICATION_HISTORY_URL_VISITED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@373326.2
Patch Set: Address comments Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/provider/chrome_browser_provider.h
diff --git a/chrome/browser/android/provider/chrome_browser_provider.h b/chrome/browser/android/provider/chrome_browser_provider.h
index 776efe47d69d2ef9ffd80a0698c2ee62bea9ff38..13c65a4348d9072f3a51dd3e1378e8bb4f7f16b8 100644
--- a/chrome/browser/android/provider/chrome_browser_provider.h
+++ b/chrome/browser/android/provider/chrome_browser_provider.h
@@ -8,10 +8,12 @@
#include "base/android/jni_weak_ref.h"
#include "base/android/scoped_java_ref.h"
#include "base/memory/scoped_ptr.h"
+#include "base/scoped_observer.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/cancelable_task_tracker.h"
#include "components/bookmarks/browser/base_bookmark_model_observer.h"
#include "components/history/core/android/android_history_types.h"
+#include "components/history/core/browser/history_service_observer.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -29,7 +31,8 @@ class Statement;
// This class implements the native methods of ChromeBrowserProvider.java
class ChromeBrowserProvider : public BaseBookmarkModelObserver,
- public content::NotificationObserver {
+ public content::NotificationObserver,
+ public history::HistoryServiceObserver {
public:
ChromeBrowserProvider(JNIEnv* env, jobject obj);
void Destroy(JNIEnv*, jobject);
@@ -179,6 +182,16 @@ class ChromeBrowserProvider : public BaseBookmarkModelObserver,
virtual void ExtensiveBookmarkChangesBeginning(BookmarkModel* model) override;
virtual void ExtensiveBookmarkChangesEnded(BookmarkModel* model) override;
+ // Deals with updates to the history service.
+ void OnHistoryChanged();
+
+ // Override HistoryServiceObserver.
+ virtual void OnURLVisited(HistoryService* history_service,
+ ui::PageTransition transition,
+ const history::URLRow& row,
+ const history::RedirectList& redirects,
+ base::Time visit_time) override;
+
// Override NotificationObserver.
virtual void Observe(int type,
const content::NotificationSource& source,
@@ -186,6 +199,11 @@ class ChromeBrowserProvider : public BaseBookmarkModelObserver,
JavaObjectWeakGlobalRef weak_java_provider_;
+ // Profile must outlive this object.
+ //
+ // BookmarkModel, HistoryService and history::TopSites lifetime is bound to
+ // the lifetime of Profile, they are safe to use as long as the Profile is
+ // alive.
Profile* profile_;
BookmarkModel* bookmark_model_;
history::TopSites* top_sites_;
@@ -197,6 +215,8 @@ class ChromeBrowserProvider : public BaseBookmarkModelObserver,
// Used to register/unregister notification observer.
content::NotificationRegistrar notification_registrar_;
+ ScopedObserver<HistoryService, HistoryServiceObserver>
+ history_service_observer_;
bool handling_extensive_changes_;
« no previous file with comments | « athena/extensions/shell/url_search_provider.cc ('k') | chrome/browser/android/provider/chrome_browser_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698