| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ | 5 #ifndef CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ |
| 6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ | 6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictor); | 422 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictor); |
| 423 }; | 423 }; |
| 424 | 424 |
| 425 // An interface used to notify that data in the ResourcePrefetchPredictor | 425 // An interface used to notify that data in the ResourcePrefetchPredictor |
| 426 // has changed. All methods are invoked on the UI thread. | 426 // has changed. All methods are invoked on the UI thread. |
| 427 class TestObserver { | 427 class TestObserver { |
| 428 public: | 428 public: |
| 429 // De-registers itself from |predictor_| on destruction. | 429 // De-registers itself from |predictor_| on destruction. |
| 430 virtual ~TestObserver(); | 430 virtual ~TestObserver(); |
| 431 | 431 |
| 432 virtual void OnPredictorInitialized() {} |
| 433 |
| 432 virtual void OnNavigationLearned( | 434 virtual void OnNavigationLearned( |
| 433 size_t url_visit_count, | 435 size_t url_visit_count, |
| 434 const ResourcePrefetchPredictor::PageRequestSummary& summary) {} | 436 const ResourcePrefetchPredictor::PageRequestSummary& summary) {} |
| 435 | 437 |
| 438 virtual void OnPrefetchingStarted(const GURL& main_frame_url) {} |
| 439 |
| 440 virtual void OnPrefetchingStopped(const GURL& main_frame_url) {} |
| 441 |
| 436 virtual void OnPrefetchingFinished(const GURL& main_frame_url) {} | 442 virtual void OnPrefetchingFinished(const GURL& main_frame_url) {} |
| 437 | 443 |
| 438 virtual void OnPredictorInitialized() {} | |
| 439 | |
| 440 protected: | 444 protected: |
| 441 // |predictor| must be non-NULL and has to outlive the TestObserver. | 445 // |predictor| must be non-NULL and has to outlive the TestObserver. |
| 442 // Also the predictor must not have a TestObserver set. | 446 // Also the predictor must not have a TestObserver set. |
| 443 explicit TestObserver(ResourcePrefetchPredictor* predictor); | 447 explicit TestObserver(ResourcePrefetchPredictor* predictor); |
| 444 | 448 |
| 445 private: | 449 private: |
| 446 ResourcePrefetchPredictor* predictor_; | 450 ResourcePrefetchPredictor* predictor_; |
| 447 | 451 |
| 448 DISALLOW_COPY_AND_ASSIGN(TestObserver); | 452 DISALLOW_COPY_AND_ASSIGN(TestObserver); |
| 449 }; | 453 }; |
| 450 | 454 |
| 451 } // namespace predictors | 455 } // namespace predictors |
| 452 | 456 |
| 453 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ | 457 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ |
| OLD | NEW |