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

Unified Diff: chrome/browser/predictors/autocomplete_action_predictor.h

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/predictors/autocomplete_action_predictor.h
diff --git a/chrome/browser/predictors/autocomplete_action_predictor.h b/chrome/browser/predictors/autocomplete_action_predictor.h
index e75cb082e189435082c1ff9cbdb99a689d53b643..fea418ae3b1f15dac0308de9396105941261bc11 100644
--- a/chrome/browser/predictors/autocomplete_action_predictor.h
+++ b/chrome/browser/predictors/autocomplete_action_predictor.h
@@ -11,8 +11,10 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "base/scoped_observer.h"
#include "base/strings/string16.h"
#include "chrome/browser/predictors/autocomplete_action_predictor_table.h"
+#include "components/history/core/browser/history_service_observer.h"
#include "components/history/core/browser/history_types.h"
#include "components/keyed_service/core/keyed_service.h"
#include "content/public/browser/navigation_controller.h"
@@ -61,6 +63,7 @@ namespace predictors {
class AutocompleteActionPredictor
: public KeyedService,
public content::NotificationObserver,
+ public history::HistoryServiceObserver,
public base::SupportsWeakPtr<AutocompleteActionPredictor> {
public:
enum Action {
@@ -215,6 +218,12 @@ class AutocompleteActionPredictor
// Calculates the confidence for an entry in the DBCacheMap.
double CalculateConfidenceForDbEntry(DBCacheMap::const_iterator iter) const;
+ // KeyedService:
+ void Shutdown() override;
+
+ // history::HistoryServiceObserver:
+ void OnHistoryServiceLoaded(HistoryService* history_service) override;
+
Profile* profile_;
// Set when this is a predictor for an incognito profile.
@@ -246,6 +255,9 @@ class AutocompleteActionPredictor
bool initialized_;
+ ScopedObserver<HistoryService, HistoryServiceObserver>
+ history_service_observer_;
+
DISALLOW_COPY_AND_ASSIGN(AutocompleteActionPredictor);
};

Powered by Google App Engine
This is Rietveld 408576698