#include "base/logging.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/history/history_notifications.h"
+#include "chrome/browser/history/history_service.h"
#include "chrome/browser/history/top_sites.h"
#include "chrome/browser/ui/profile_error_dialog.h"
#include "chrome/common/chrome_version_info.h"
history::TopSites* top_sites)
: bookmark_model_(bookmark_model),
profile_(profile),
+ history_service_(nullptr),
top_sites_(top_sites) {
DCHECK(bookmark_model_);
if (top_sites_)
top_sites_->RemoveObserver(this);
}
+void ChromeHistoryClient::SetHistoryService(HistoryService* history_service) {
+ DCHECK(history_service);
+ history_service_ = history_service;
+ history_service_->AddObserver(this);
+}
+
void ChromeHistoryClient::BlockUntilBookmarksLoaded() {
bookmark_model_->BlockTillLoaded();
}
// shutdown (HistoryService::Cleanup to complete). In such a scenario history
// sees an incorrect view of bookmarks, but it's better than a deadlock.
bookmark_model_->Shutdown();
+ if (history_service_) {
+ history_service_->RemoveObserver(this);
+ history_service_ = nullptr;
+ }
}
void ChromeHistoryClient::TopSitesLoaded(history::TopSites* top_sites) {