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 1504370eadcad3230a58d5a1ef768c75d0144d2b..1225a22bae523045d52f5ee67786cf28eeb1d3ab 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. |
@@ -293,6 +296,13 @@ class ResourcePrefetchPredictor |
size_t total_resources_fetched_from_network, |
size_t max_assumed_prefetched) const; |
+ // history::HistoryServiceObserver: |
+ void OnHistoryServiceLoaded(HistoryService* history_service) override; |
+ |
+ // Used to connect to HistoryService or register for service loaded |
+ // notificatioan. |
+ void ConnectToHistoryService(); |
+ |
// Used for testing to inject mock tables. |
void set_mock_tables(scoped_refptr<ResourcePrefetchPredictorTables> tables) { |
tables_ = tables; |
@@ -316,6 +326,9 @@ class ResourcePrefetchPredictor |
ResultsMap results_map_; |
STLValueDeleter<ResultsMap> results_map_deleter_; |
+ ScopedObserver<HistoryService, history::HistoryServiceObserver> |
+ history_service_observer_; |
+ |
DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictor); |
}; |