OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ |
6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ | 6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 // Stores the given background sync registration and adds it to the scheduling | 62 // Stores the given background sync registration and adds it to the scheduling |
63 // queue. It will overwrite an existing registration with the same tag and | 63 // queue. It will overwrite an existing registration with the same tag and |
64 // periodicity unless they're identical (save for the id). Calls |callback| | 64 // periodicity unless they're identical (save for the id). Calls |callback| |
65 // with BACKGROUND_SYNC_STATUS_OK and the accepted registration on success. | 65 // with BACKGROUND_SYNC_STATUS_OK and the accepted registration on success. |
66 // The accepted registration will have a unique id. It may also have altered | 66 // The accepted registration will have a unique id. It may also have altered |
67 // parameters if the user or UA chose different parameters than those | 67 // parameters if the user or UA chose different parameters than those |
68 // supplied. | 68 // supplied. |
69 void Register(int64 sw_registration_id, | 69 void Register(int64 sw_registration_id, |
70 const BackgroundSyncRegistrationOptions& options, | 70 const BackgroundSyncRegistrationOptions& options, |
| 71 bool requested_from_service_worker, |
71 const StatusAndRegistrationCallback& callback); | 72 const StatusAndRegistrationCallback& callback); |
72 | 73 |
73 // Removes the background sync with tag |sync_registration_tag|, periodicity | 74 // Removes the background sync with tag |sync_registration_tag|, periodicity |
74 // |periodicity|, and id |sync_registration_id|. Calls |callback| with | 75 // |periodicity|, and id |sync_registration_id|. Calls |callback| with |
75 // BACKGROUND_SYNC_STATUS_NOT_FOUND if no match is found. Calls |callback| | 76 // BACKGROUND_SYNC_STATUS_NOT_FOUND if no match is found. Calls |callback| |
76 // with BACKGROUND_SYNC_STATUS_OK on success. | 77 // with BACKGROUND_SYNC_STATUS_OK on success. |
77 void Unregister( | 78 void Unregister( |
78 int64 sw_registration_id, | 79 int64 sw_registration_id, |
79 const std::string& sync_registration_tag, | 80 const std::string& sync_registration_tag, |
80 SyncPeriodicity periodicity, | 81 SyncPeriodicity periodicity, |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 189 |
189 void InitImpl(const base::Closure& callback); | 190 void InitImpl(const base::Closure& callback); |
190 void InitDidGetDataFromBackend( | 191 void InitDidGetDataFromBackend( |
191 const base::Closure& callback, | 192 const base::Closure& callback, |
192 const std::vector<std::pair<int64, std::string>>& user_data, | 193 const std::vector<std::pair<int64, std::string>>& user_data, |
193 ServiceWorkerStatusCode status); | 194 ServiceWorkerStatusCode status); |
194 | 195 |
195 // Register callbacks | 196 // Register callbacks |
196 void RegisterImpl(int64 sw_registration_id, | 197 void RegisterImpl(int64 sw_registration_id, |
197 const BackgroundSyncRegistrationOptions& options, | 198 const BackgroundSyncRegistrationOptions& options, |
| 199 bool requested_from_service_worker, |
198 const StatusAndRegistrationCallback& callback); | 200 const StatusAndRegistrationCallback& callback); |
199 void RegisterDidStore(int64 sw_registration_id, | 201 void RegisterDidStore(int64 sw_registration_id, |
200 const BackgroundSyncRegistration& sync_registration, | 202 const BackgroundSyncRegistration& sync_registration, |
201 const StatusAndRegistrationCallback& callback, | 203 const StatusAndRegistrationCallback& callback, |
202 ServiceWorkerStatusCode status); | 204 ServiceWorkerStatusCode status); |
203 | 205 |
204 // Unregister callbacks | 206 // Unregister callbacks |
205 void UnregisterImpl( | 207 void UnregisterImpl( |
206 int64 sw_registration_id, | 208 int64 sw_registration_id, |
207 const RegistrationKey& registration_key, | 209 const RegistrationKey& registration_key, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 scoped_ptr<BackgroundSyncPowerObserver> power_observer_; | 302 scoped_ptr<BackgroundSyncPowerObserver> power_observer_; |
301 | 303 |
302 base::WeakPtrFactory<BackgroundSyncManager> weak_ptr_factory_; | 304 base::WeakPtrFactory<BackgroundSyncManager> weak_ptr_factory_; |
303 | 305 |
304 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncManager); | 306 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncManager); |
305 }; | 307 }; |
306 | 308 |
307 } // namespace content | 309 } // namespace content |
308 | 310 |
309 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ | 311 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ |
OLD | NEW |