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) { |