| 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, | |
| 72 const StatusAndRegistrationCallback& callback); | 71 const StatusAndRegistrationCallback& callback); |
| 73 | 72 |
| 74 // Removes the background sync with tag |sync_registration_tag|, periodicity | 73 // Removes the background sync with tag |sync_registration_tag|, periodicity |
| 75 // |periodicity|, and id |sync_registration_id|. Calls |callback| with | 74 // |periodicity|, and id |sync_registration_id|. Calls |callback| with |
| 76 // BACKGROUND_SYNC_STATUS_NOT_FOUND if no match is found. Calls |callback| | 75 // BACKGROUND_SYNC_STATUS_NOT_FOUND if no match is found. Calls |callback| |
| 77 // with BACKGROUND_SYNC_STATUS_OK on success. | 76 // with BACKGROUND_SYNC_STATUS_OK on success. |
| 78 void Unregister( | 77 void Unregister( |
| 79 int64 sw_registration_id, | 78 int64 sw_registration_id, |
| 80 const std::string& sync_registration_tag, | 79 const std::string& sync_registration_tag, |
| 81 SyncPeriodicity periodicity, | 80 SyncPeriodicity periodicity, |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 188 |
| 190 void InitImpl(const base::Closure& callback); | 189 void InitImpl(const base::Closure& callback); |
| 191 void InitDidGetDataFromBackend( | 190 void InitDidGetDataFromBackend( |
| 192 const base::Closure& callback, | 191 const base::Closure& callback, |
| 193 const std::vector<std::pair<int64, std::string>>& user_data, | 192 const std::vector<std::pair<int64, std::string>>& user_data, |
| 194 ServiceWorkerStatusCode status); | 193 ServiceWorkerStatusCode status); |
| 195 | 194 |
| 196 // Register callbacks | 195 // Register callbacks |
| 197 void RegisterImpl(int64 sw_registration_id, | 196 void RegisterImpl(int64 sw_registration_id, |
| 198 const BackgroundSyncRegistrationOptions& options, | 197 const BackgroundSyncRegistrationOptions& options, |
| 199 bool requested_from_service_worker, | |
| 200 const StatusAndRegistrationCallback& callback); | 198 const StatusAndRegistrationCallback& callback); |
| 201 void RegisterDidStore(int64 sw_registration_id, | 199 void RegisterDidStore(int64 sw_registration_id, |
| 202 const BackgroundSyncRegistration& sync_registration, | 200 const BackgroundSyncRegistration& sync_registration, |
| 203 const StatusAndRegistrationCallback& callback, | 201 const StatusAndRegistrationCallback& callback, |
| 204 ServiceWorkerStatusCode status); | 202 ServiceWorkerStatusCode status); |
| 205 | 203 |
| 206 // Unregister callbacks | 204 // Unregister callbacks |
| 207 void UnregisterImpl( | 205 void UnregisterImpl( |
| 208 int64 sw_registration_id, | 206 int64 sw_registration_id, |
| 209 const RegistrationKey& registration_key, | 207 const RegistrationKey& registration_key, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 scoped_ptr<BackgroundSyncPowerObserver> power_observer_; | 300 scoped_ptr<BackgroundSyncPowerObserver> power_observer_; |
| 303 | 301 |
| 304 base::WeakPtrFactory<BackgroundSyncManager> weak_ptr_factory_; | 302 base::WeakPtrFactory<BackgroundSyncManager> weak_ptr_factory_; |
| 305 | 303 |
| 306 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncManager); | 304 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncManager); |
| 307 }; | 305 }; |
| 308 | 306 |
| 309 } // namespace content | 307 } // namespace content |
| 310 | 308 |
| 311 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ | 309 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ |
| OLD | NEW |