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

Unified Diff: chrome/browser/sync/glue/bookmark_data_type_controller.h

Issue 573553004: Eliminate NOTIFICATION_HISTORY_LOADED notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ScopedObserver to InMemoryHistoryBackend,PrerenderLocalPredictor,ChromeTemplateURLServiceClient Created 6 years, 1 month 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/sync/glue/bookmark_data_type_controller.h
diff --git a/chrome/browser/sync/glue/bookmark_data_type_controller.h b/chrome/browser/sync/glue/bookmark_data_type_controller.h
index b234931a688f2fa2bb9e8202cb090734465731ba..0c942dea8bb75cc53f1ea018a5850647710172e7 100644
--- a/chrome/browser/sync/glue/bookmark_data_type_controller.h
+++ b/chrome/browser/sync/glue/bookmark_data_type_controller.h
@@ -8,17 +8,17 @@
#include <string>
#include "base/compiler_specific.h"
+#include "base/scoped_observer.h"
#include "chrome/browser/sync/glue/frontend_data_type_controller.h"
#include "components/bookmarks/browser/base_bookmark_model_observer.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
+#include "components/history/core/browser/history_service_observer.h"
namespace browser_sync {
// A class that manages the startup and shutdown of bookmark sync.
class BookmarkDataTypeController : public FrontendDataTypeController,
- public content::NotificationObserver,
- public bookmarks::BaseBookmarkModelObserver {
+ public bookmarks::BaseBookmarkModelObserver,
+ public history::HistoryServiceObserver {
public:
BookmarkDataTypeController(ProfileSyncComponentsFactory* profile_sync_factory,
Profile* profile,
@@ -27,11 +27,6 @@ class BookmarkDataTypeController : public FrontendDataTypeController,
// FrontendDataTypeController:
syncer::ModelType type() const override;
- // content::NotificationObserver:
- void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) override;
-
private:
~BookmarkDataTypeController() override;
@@ -49,12 +44,14 @@ class BookmarkDataTypeController : public FrontendDataTypeController,
// service have finished loading.
bool DependentsLoaded();
- content::NotificationRegistrar registrar_;
-
- BookmarkModel* bookmark_model_;
+ // history::HistoryServiceObserver:
+ void OnHistoryServiceLoaded(HistoryService* service) override;
+ void HistoryServiceBeingDeleted(HistoryService* history_service) override;
- // Have we installed ourselves as a BookmarkModel observer?
- bool installed_bookmark_observer_;
+ ScopedObserver<HistoryService, HistoryServiceObserver>
+ history_service_observer_;
+ ScopedObserver<BookmarkModel, BaseBookmarkModelObserver>
+ bookmark_model_observer_;
DISALLOW_COPY_AND_ASSIGN(BookmarkDataTypeController);
};

Powered by Google App Engine
This is Rietveld 408576698