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 #include "components/offline_pages/core/offline_page_item.h" | 9 #include "components/offline_pages/core/offline_page_item.h" |
10 | 10 |
11 class GURL; | 11 class GURL; |
12 | 12 |
| 13 namespace gcm { |
| 14 class GCMDriver; |
| 15 } |
| 16 |
13 namespace offline_pages { | 17 namespace offline_pages { |
14 | 18 |
15 // Main class for the Offline Pages Prefetching feature, which will ask a server | 19 // Main class for the Offline Pages Prefetching feature, which will ask a server |
16 // to package content from interesting URLs and send it to Chrome for | 20 // to package content from interesting URLs and send it to Chrome for |
17 // consumption while offline. | 21 // consumption while offline. |
18 class PrefetchService : public KeyedService { | 22 class PrefetchService : public KeyedService { |
19 public: | 23 public: |
20 struct PrefetchURL { | 24 struct PrefetchURL { |
21 // Used to differentiate URLs from different sources. |name_space| should | 25 // Used to differentiate URLs from different sources. |name_space| should |
22 // be unique per source. |id| can be anything useful to identify the page, | 26 // be unique per source. |id| can be anything useful to identify the page, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // Called when Android OS has scheduled us for background work. When | 64 // Called when Android OS has scheduled us for background work. When |
61 // destroyed, |task| will call back and inform the OS that we are done work | 65 // destroyed, |task| will call back and inform the OS that we are done work |
62 // (if required). |task| also manages rescheduling behavior. | 66 // (if required). |task| also manages rescheduling behavior. |
63 virtual void BeginBackgroundTask( | 67 virtual void BeginBackgroundTask( |
64 std::unique_ptr<ScopedBackgroundTask> task) = 0; | 68 std::unique_ptr<ScopedBackgroundTask> task) = 0; |
65 | 69 |
66 // Called when a task must stop immediately due to system constraints. After | 70 // Called when a task must stop immediately due to system constraints. After |
67 // this call completes, the system will reschedule the task based on whether | 71 // this call completes, the system will reschedule the task based on whether |
68 // SetNeedsReschedule has been called. | 72 // SetNeedsReschedule has been called. |
69 virtual void StopBackgroundTask(ScopedBackgroundTask* task) = 0; | 73 virtual void StopBackgroundTask(ScopedBackgroundTask* task) = 0; |
| 74 |
| 75 // When GCMDriver starts up, this method is called so that we can listen for |
| 76 // messages corresponding to our app ID. |
| 77 virtual void RegisterWithGCMDriver(gcm::GCMDriver* driver) = 0; |
70 }; | 78 }; |
71 | 79 |
72 } // namespace offline_pages | 80 } // namespace offline_pages |
73 | 81 |
74 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_SERVICE_IMPL_H_ | 82 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_SERVICE_IMPL_H_ |
OLD | NEW |