| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_SERVICE_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_SERVICE_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_SERVICE_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_SERVICE_H_ |
| 7 | 7 |
| 8 #include "components/keyed_service/core/keyed_service.h" | 8 #include "components/keyed_service/core/keyed_service.h" |
| 9 | 9 |
| 10 namespace ntp_snippets { | 10 namespace ntp_snippets { |
| 11 class ContentSuggestionsService; | 11 class ContentSuggestionsService; |
| 12 } | 12 } |
| 13 | 13 |
| 14 namespace offline_pages { | 14 namespace offline_pages { |
| 15 | |
| 16 class OfflineMetricsCollector; | 15 class OfflineMetricsCollector; |
| 17 class PrefetchDispatcher; | 16 class PrefetchDispatcher; |
| 18 class PrefetchGCMHandler; | 17 class PrefetchGCMHandler; |
| 18 class PrefetchStore; |
| 19 | 19 |
| 20 // Main class and entry point for the Offline Pages Prefetching feature, that | 20 // Main class and entry point for the Offline Pages Prefetching feature, that |
| 21 // controls the lifetime of all major subcomponents of the prefetching system. | 21 // controls the lifetime of all major subcomponents of the prefetching system. |
| 22 class PrefetchService : public KeyedService { | 22 class PrefetchService : public KeyedService { |
| 23 public: | 23 public: |
| 24 ~PrefetchService() override = default; | 24 ~PrefetchService() override = default; |
| 25 | 25 |
| 26 // Subobjects that are created and owned by this service. Creation should be | 26 // Subobjects that are created and owned by this service. Creation should be |
| 27 // lightweight, all heavy work must be done on-demand only. | 27 // lightweight, all heavy work must be done on-demand only. |
| 28 // The service manages lifetime, hookup and initialization of Prefetch | 28 // The service manages lifetime, hookup and initialization of Prefetch |
| 29 // system that consists of multiple specialized objects, all vended by this | 29 // system that consists of multiple specialized objects, all vended by this |
| 30 // service. All pointers are raw and are always valid. | 30 // service. All pointers are raw and are always valid. |
| 31 virtual PrefetchDispatcher* GetDispatcher() = 0; | |
| 32 virtual OfflineMetricsCollector* GetOfflineMetricsCollector() = 0; | 31 virtual OfflineMetricsCollector* GetOfflineMetricsCollector() = 0; |
| 32 virtual PrefetchDispatcher* GetPrefetchDispatcher() = 0; |
| 33 virtual PrefetchGCMHandler* GetPrefetchGCMHandler() = 0; | 33 virtual PrefetchGCMHandler* GetPrefetchGCMHandler() = 0; |
| 34 virtual PrefetchStore* GetPrefetchStore() = 0; |
| 34 | 35 |
| 35 // Called at construction of the ContentSuggestionsService to begin observing | 36 // Called at construction of the ContentSuggestionsService to begin observing |
| 36 // events related to incoming articles. | 37 // events related to incoming articles. |
| 37 virtual void ObserveContentSuggestionsService( | 38 virtual void ObserveContentSuggestionsService( |
| 38 ntp_snippets::ContentSuggestionsService* service) = 0; | 39 ntp_snippets::ContentSuggestionsService* service) = 0; |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 } // namespace offline_pages | 42 } // namespace offline_pages |
| 42 | 43 |
| 43 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_SERVICE_H_ | 44 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_SERVICE_H_ |
| OLD | NEW |