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

Unified Diff: chrome/browser/search_engines/chrome_template_url_service_client.cc

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/search_engines/chrome_template_url_service_client.cc
diff --git a/chrome/browser/search_engines/chrome_template_url_service_client.cc b/chrome/browser/search_engines/chrome_template_url_service_client.cc
index 58447bb06b1480b9fb9198e36303aa32fbae20d6..1a4cf80b1ff8bb1bd9f70b3d801827889fc67e09 100644
--- a/chrome/browser/search_engines/chrome_template_url_service_client.cc
+++ b/chrome/browser/search_engines/chrome_template_url_service_client.cc
@@ -10,13 +10,15 @@
ChromeTemplateURLServiceClient::ChromeTemplateURLServiceClient(
HistoryService* history_service)
- : owner_(NULL), history_service_(history_service) {
+ : owner_(NULL),
+ history_service_observer_(this),
+ history_service_(history_service) {
// TODO(sky): bug 1166191. The keywords should be moved into the history
// db, which will mean we no longer need this notification and the history
// backend can handle automatically adding the search terms as the user
// navigates.
if (history_service_)
- history_service_->AddObserver(this);
+ history_service_observer_.Add(history_service_);
}
ChromeTemplateURLServiceClient::~ChromeTemplateURLServiceClient() {
@@ -30,8 +32,7 @@ void ChromeTemplateURLServiceClient::Shutdown() {
// Remove self from |history_service_| observers in the shutdown phase of the
// two-phases since KeyedService are not supposed to use a dependend service
// after the Shutdown call.
- if (history_service_)
- history_service_->RemoveObserver(this);
+ history_service_observer_.RemoveAll();
}
void ChromeTemplateURLServiceClient::SetOwner(TemplateURLService* owner) {

Powered by Google App Engine
This is Rietveld 408576698