| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "content/browser/background_sync/background_sync_registration.h" | 24 #include "content/browser/background_sync/background_sync_registration.h" |
| 25 #include "content/browser/background_sync/background_sync_status.h" | 25 #include "content/browser/background_sync/background_sync_status.h" |
| 26 #include "content/browser/cache_storage/cache_storage_scheduler.h" | 26 #include "content/browser/cache_storage/cache_storage_scheduler.h" |
| 27 #include "content/browser/service_worker/service_worker_context_observer.h" | 27 #include "content/browser/service_worker/service_worker_context_observer.h" |
| 28 #include "content/browser/service_worker/service_worker_storage.h" | 28 #include "content/browser/service_worker/service_worker_storage.h" |
| 29 #include "content/common/background_sync_service.mojom.h" | 29 #include "content/common/background_sync_service.mojom.h" |
| 30 #include "content/common/content_export.h" | 30 #include "content/common/content_export.h" |
| 31 #include "content/common/service_worker/service_worker_status_code.h" | 31 #include "content/common/service_worker/service_worker_status_code.h" |
| 32 #include "content/public/browser/background_sync_parameters.h" | 32 #include "content/public/browser/background_sync_parameters.h" |
| 33 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
| 34 #include "content/public/common/permission_status.mojom.h" | 34 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat
us.mojom.h" |
| 35 #include "url/gurl.h" | 35 #include "url/gurl.h" |
| 36 | 36 |
| 37 namespace blink { |
| 38 namespace mojom { |
| 39 enum class PermissionStatus; |
| 40 } |
| 41 } |
| 42 |
| 37 namespace content { | 43 namespace content { |
| 38 | 44 |
| 39 class BackgroundSyncNetworkObserver; | 45 class BackgroundSyncNetworkObserver; |
| 40 enum class PermissionStatus; | |
| 41 class ServiceWorkerContextWrapper; | 46 class ServiceWorkerContextWrapper; |
| 42 | 47 |
| 43 // BackgroundSyncManager manages and stores the set of background sync | 48 // BackgroundSyncManager manages and stores the set of background sync |
| 44 // registrations across all registered service workers for a profile. | 49 // registrations across all registered service workers for a profile. |
| 45 // Registrations are stored along with their associated Service Worker | 50 // Registrations are stored along with their associated Service Worker |
| 46 // registration in ServiceWorkerStorage. If the ServiceWorker is unregistered, | 51 // registration in ServiceWorkerStorage. If the ServiceWorker is unregistered, |
| 47 // the sync registrations are removed. This class must be run on the IO | 52 // the sync registrations are removed. This class must be run on the IO |
| 48 // thread. The asynchronous methods are executed sequentially. | 53 // thread. The asynchronous methods are executed sequentially. |
| 49 class CONTENT_EXPORT BackgroundSyncManager | 54 class CONTENT_EXPORT BackgroundSyncManager |
| 50 : NON_EXPORTED_BASE(public ServiceWorkerContextObserver) { | 55 : NON_EXPORTED_BASE(public ServiceWorkerContextObserver) { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 const BackgroundSyncRegistrationOptions& options, | 202 const BackgroundSyncRegistrationOptions& options, |
| 198 const StatusAndRegistrationCallback& callback, | 203 const StatusAndRegistrationCallback& callback, |
| 199 bool has_main_frame_client); | 204 bool has_main_frame_client); |
| 200 void RegisterImpl(int64_t sw_registration_id, | 205 void RegisterImpl(int64_t sw_registration_id, |
| 201 const BackgroundSyncRegistrationOptions& options, | 206 const BackgroundSyncRegistrationOptions& options, |
| 202 const StatusAndRegistrationCallback& callback); | 207 const StatusAndRegistrationCallback& callback); |
| 203 void RegisterDidAskForPermission( | 208 void RegisterDidAskForPermission( |
| 204 int64_t sw_registration_id, | 209 int64_t sw_registration_id, |
| 205 const BackgroundSyncRegistrationOptions& options, | 210 const BackgroundSyncRegistrationOptions& options, |
| 206 const StatusAndRegistrationCallback& callback, | 211 const StatusAndRegistrationCallback& callback, |
| 207 mojom::PermissionStatus permission_status); | 212 blink::mojom::PermissionStatus permission_status); |
| 208 void RegisterDidStore(int64_t sw_registration_id, | 213 void RegisterDidStore(int64_t sw_registration_id, |
| 209 const BackgroundSyncRegistration& new_registration, | 214 const BackgroundSyncRegistration& new_registration, |
| 210 const StatusAndRegistrationCallback& callback, | 215 const StatusAndRegistrationCallback& callback, |
| 211 ServiceWorkerStatusCode status); | 216 ServiceWorkerStatusCode status); |
| 212 | 217 |
| 213 // GetRegistrations callbacks | 218 // GetRegistrations callbacks |
| 214 void GetRegistrationsImpl(int64_t sw_registration_id, | 219 void GetRegistrationsImpl(int64_t sw_registration_id, |
| 215 const StatusAndRegistrationsCallback& callback); | 220 const StatusAndRegistrationsCallback& callback); |
| 216 | 221 |
| 217 bool AreOptionConditionsMet(const BackgroundSyncRegistrationOptions& options); | 222 bool AreOptionConditionsMet(const BackgroundSyncRegistrationOptions& options); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 scoped_ptr<base::Clock> clock_; | 318 scoped_ptr<base::Clock> clock_; |
| 314 | 319 |
| 315 base::WeakPtrFactory<BackgroundSyncManager> weak_ptr_factory_; | 320 base::WeakPtrFactory<BackgroundSyncManager> weak_ptr_factory_; |
| 316 | 321 |
| 317 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncManager); | 322 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncManager); |
| 318 }; | 323 }; |
| 319 | 324 |
| 320 } // namespace content | 325 } // namespace content |
| 321 | 326 |
| 322 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ | 327 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_MANAGER_H_ |
| OLD | NEW |