Index: chrome/browser/predictors/autocomplete_action_predictor.cc |
diff --git a/chrome/browser/predictors/autocomplete_action_predictor.cc b/chrome/browser/predictors/autocomplete_action_predictor.cc |
index fed802ee7a256b6c24bed3d132d5637fb754f6e8..3d4e64a73db370d7608f52bc54047ad0bface4a8 100644 |
--- a/chrome/browser/predictors/autocomplete_action_predictor.cc |
+++ b/chrome/browser/predictors/autocomplete_action_predictor.cc |
@@ -97,6 +97,10 @@ AutocompleteActionPredictor::AutocompleteActionPredictor(Profile* profile) |
} |
AutocompleteActionPredictor::~AutocompleteActionPredictor() { |
+ HistoryService* history_service = |
sdefresne
2014/09/23 08:45:09
AutocompleteActionPredictor is a KeyedService. Sho
sdefresne
2014/10/20 13:15:42
Please move the unregistration into AutocompleteAc
nshaik
2014/10/29 08:43:39
Done.
|
+ HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); |
+ if (history_service) |
sdefresne
2014/10/20 13:15:42
Use ScopedObserver<>.
|
+ history_service->RemoveHistoryServiceObserver(this); |
if (main_profile_predictor_) |
main_profile_predictor_->incognito_predictor_ = NULL; |
else if (incognito_predictor_) |
@@ -257,15 +261,6 @@ void AutocompleteActionPredictor::Observe( |
break; |
} |
- case chrome::NOTIFICATION_HISTORY_LOADED: { |
- TryDeleteOldEntries(content::Details<HistoryService>(details).ptr()); |
- |
- notification_registrar_.Remove(this, |
- chrome::NOTIFICATION_HISTORY_LOADED, |
- content::Source<Profile>(profile_)); |
- break; |
- } |
- |
default: |
NOTREACHED() << "Unexpected notification observed."; |
break; |
@@ -481,8 +476,7 @@ void AutocompleteActionPredictor::CreateCaches( |
if (!TryDeleteOldEntries(history_service)) { |
// Wait for the notification that the history service is ready and the URL |
// DB is loaded. |
- notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_LOADED, |
- content::Source<Profile>(profile_)); |
+ history_service->AddHistoryServiceObserver(this); |
} |
} |
@@ -609,4 +603,10 @@ AutocompleteActionPredictor::TransitionalMatch::TransitionalMatch() { |
AutocompleteActionPredictor::TransitionalMatch::~TransitionalMatch() { |
} |
+void AutocompleteActionPredictor::HistoryServiceLoaded( |
+ HistoryService* history_service) { |
+ TryDeleteOldEntries(history_service); |
+ history_service->RemoveHistoryServiceObserver(this); |
+} |
+ |
} // namespace predictors |