| Index: chrome/browser/sync/glue/bookmark_data_type_controller.cc
|
| diff --git a/chrome/browser/sync/glue/bookmark_data_type_controller.cc b/chrome/browser/sync/glue/bookmark_data_type_controller.cc
|
| index 9e9da929d0b0829a95c485f6dff5812b09d52234..2182b6b00d49e2a2f08d53eec1c7ea4f595cc892 100644
|
| --- a/chrome/browser/sync/glue/bookmark_data_type_controller.cc
|
| +++ b/chrome/browser/sync/glue/bookmark_data_type_controller.cc
|
| @@ -40,24 +40,6 @@ syncer::ModelType BookmarkDataTypeController::type() const {
|
| return syncer::BOOKMARKS;
|
| }
|
|
|
| -void BookmarkDataTypeController::Observe(
|
| - int type,
|
| - const content::NotificationSource& source,
|
| - const content::NotificationDetails& details) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| - DCHECK_EQ(state_, MODEL_STARTING);
|
| - DCHECK_EQ(chrome::NOTIFICATION_HISTORY_LOADED, type);
|
| -
|
| - if (!DependentsLoaded())
|
| - return;
|
| -
|
| - bookmark_model_->RemoveObserver(this);
|
| - installed_bookmark_observer_ = false;
|
| -
|
| - registrar_.RemoveAll();
|
| - OnModelLoaded();
|
| -}
|
| -
|
| BookmarkDataTypeController::~BookmarkDataTypeController() {
|
| if (installed_bookmark_observer_ && bookmark_model_) {
|
| DCHECK(profile_);
|
| @@ -70,17 +52,18 @@ bool BookmarkDataTypeController::StartModels() {
|
| if (!DependentsLoaded()) {
|
| bookmark_model_->AddObserver(this);
|
| installed_bookmark_observer_ = true;
|
| -
|
| - registrar_.Add(this, chrome::NOTIFICATION_HISTORY_LOADED,
|
| - content::Source<Profile>(sync_service_->profile()));
|
| + HistoryService* history_service = HistoryServiceFactory::GetForProfile(
|
| + profile_, Profile::EXPLICIT_ACCESS);
|
| + history_service->AddObserver(this);
|
| return false;
|
| }
|
| return true;
|
| }
|
|
|
| -// Cleanup for our extra registrar usage.
|
| void BookmarkDataTypeController::CleanUpState() {
|
| - registrar_.RemoveAll();
|
| + HistoryService* history_service =
|
| + HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
|
| + history_service->RemoveObserver(this);
|
| if (bookmark_model_ && installed_bookmark_observer_) {
|
| bookmark_model_->RemoveObserver(this);
|
| installed_bookmark_observer_ = false;
|
| @@ -107,7 +90,6 @@ void BookmarkDataTypeController::BookmarkModelLoaded(BookmarkModel* model,
|
| if (!DependentsLoaded())
|
| return;
|
|
|
| - registrar_.RemoveAll();
|
| OnModelLoaded();
|
| }
|
|
|
| @@ -131,4 +113,18 @@ bool BookmarkDataTypeController::DependentsLoaded() {
|
| return true;
|
| }
|
|
|
| +void BookmarkDataTypeController::OnHistoryServiceLoaded(
|
| + HistoryService* service) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| + DCHECK_EQ(state_, MODEL_STARTING);
|
| + service->RemoveObserver(this);
|
| +
|
| + if (!DependentsLoaded())
|
| + return;
|
| +
|
| + bookmark_model_->RemoveObserver(this);
|
| + installed_bookmark_observer_ = false;
|
| + OnModelLoaded();
|
| +}
|
| +
|
| } // namespace browser_sync
|
|
|