Chromium Code Reviews| Index: chrome/browser/predictors/resource_prefetch_predictor.h |
| diff --git a/chrome/browser/predictors/resource_prefetch_predictor.h b/chrome/browser/predictors/resource_prefetch_predictor.h |
| index c6eb7157c458f932467670b46cdffb12150189f1..af693582544d12b32a530cfecdf0ac31a5c5fb38 100644 |
| --- a/chrome/browser/predictors/resource_prefetch_predictor.h |
| +++ b/chrome/browser/predictors/resource_prefetch_predictor.h |
| @@ -13,11 +13,13 @@ |
| #include "base/memory/linked_ptr.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/memory/weak_ptr.h" |
| +#include "base/scoped_observer.h" |
| #include "base/task/cancelable_task_tracker.h" |
| #include "base/time/time.h" |
| #include "chrome/browser/predictors/resource_prefetch_common.h" |
| #include "chrome/browser/predictors/resource_prefetch_predictor_tables.h" |
| #include "chrome/browser/predictors/resource_prefetcher.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/notification_observer.h" |
| @@ -75,6 +77,7 @@ class ResourcePrefetcherManager; |
| class ResourcePrefetchPredictor |
| : public KeyedService, |
| public content::NotificationObserver, |
| + public history::HistoryServiceObserver, |
| public base::SupportsWeakPtr<ResourcePrefetchPredictor> { |
| public: |
| // Stores the data that we need to get from the URLRequest. |
| @@ -126,6 +129,9 @@ class ResourcePrefetchPredictor |
| PrefetchKeyType key_type, |
| ResourcePrefetcher::RequestVector* requests); |
| + // history::HistoryServiceObserver: |
| + virtual void OnHistoryServiceLoaded(HistoryService* history_service) override; |
|
sdefresne
2014/10/30 17:37:04
style: remove "virtual"
nshaik
2014/10/30 21:48:36
Done.
|
| + |
| private: |
| friend class ::PredictorsHandler; |
| friend class ResourcePrefetchPredictorTest; |
| @@ -288,6 +294,10 @@ class ResourcePrefetchPredictor |
| tables_ = tables; |
| } |
| + // If HistoryService is loaded then calls the Initialization function |
| + // else Observe for the HistoryService to be loaded. |
| + bool CheckForHistoryService(); |
| + |
| Profile* const profile_; |
| ResourcePrefetchPredictorConfig const config_; |
| InitializationState initialization_state_; |
| @@ -306,6 +316,9 @@ class ResourcePrefetchPredictor |
| ResultsMap results_map_; |
| STLValueDeleter<ResultsMap> results_map_deleter_; |
| + ScopedObserver<HistoryService, history::HistoryServiceObserver> |
| + history_service_observer_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictor); |
| }; |