Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1241)

Side by Side Diff: components/offline_pages/core/prefetch/prefetch_service.h

Issue 2864293003: [Offline Pages] Add a GCMAppHandler for offline page prefetch. (Closed)
Patch Set: Touch ups. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698