| 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_SERVICE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_SERVICE_IMPL_H_ |
| 6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_SERVICE_IMPL_H_ | 6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_SERVICE_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 11 #include "content/browser/background_sync/background_sync_manager.h" | 10 #include "content/browser/background_sync/background_sync_manager.h" |
| 12 #include "content/common/background_sync_service.mojom.h" | 11 #include "content/common/background_sync_service.mojom.h" |
| 13 #include "mojo/public/cpp/bindings/binding.h" | |
| 14 | 12 |
| 15 namespace content { | 13 namespace content { |
| 16 | 14 |
| 17 class BackgroundSyncContextImpl; | |
| 18 | |
| 19 class CONTENT_EXPORT BackgroundSyncServiceImpl | 15 class CONTENT_EXPORT BackgroundSyncServiceImpl |
| 20 : public NON_EXPORTED_BASE(BackgroundSyncService) { | 16 : public NON_EXPORTED_BASE(BackgroundSyncService) { |
| 21 public: | 17 public: |
| 22 BackgroundSyncServiceImpl( | 18 explicit BackgroundSyncServiceImpl( |
| 23 BackgroundSyncContextImpl* background_sync_context, | 19 BackgroundSyncManager* background_sync_manager); |
| 24 mojo::InterfaceRequest<BackgroundSyncService> request); | |
| 25 | 20 |
| 26 ~BackgroundSyncServiceImpl() override; | 21 ~BackgroundSyncServiceImpl() override; |
| 27 | 22 |
| 28 private: | 23 private: |
| 29 friend class BackgroundSyncServiceImplTest; | 24 friend class BackgroundSyncServiceImplTest; |
| 30 | 25 |
| 31 // BackgroundSyncService methods: | 26 // BackgroundSyncService methods: |
| 32 void Register(content::SyncRegistrationPtr options, | 27 void Register(content::SyncRegistrationPtr options, |
| 33 int64_t sw_registration_id, | 28 int64_t sw_registration_id, |
| 34 bool requested_from_service_worker, | 29 bool requested_from_service_worker, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 61 void OnUnregisterResult(const UnregisterCallback& callback, | 56 void OnUnregisterResult(const UnregisterCallback& callback, |
| 62 BackgroundSyncStatus status); | 57 BackgroundSyncStatus status); |
| 63 void OnGetRegistrationsResult( | 58 void OnGetRegistrationsResult( |
| 64 const GetRegistrationsCallback& callback, | 59 const GetRegistrationsCallback& callback, |
| 65 BackgroundSyncStatus status, | 60 BackgroundSyncStatus status, |
| 66 scoped_ptr<ScopedVector<BackgroundSyncRegistrationHandle>> result); | 61 scoped_ptr<ScopedVector<BackgroundSyncRegistrationHandle>> result); |
| 67 void OnNotifyWhenFinishedResult(const NotifyWhenFinishedCallback& callback, | 62 void OnNotifyWhenFinishedResult(const NotifyWhenFinishedCallback& callback, |
| 68 BackgroundSyncStatus status, | 63 BackgroundSyncStatus status, |
| 69 BackgroundSyncState sync_state); | 64 BackgroundSyncState sync_state); |
| 70 | 65 |
| 71 // Called when an error is detected on binding_. | 66 BackgroundSyncManager* const background_sync_manager_; |
| 72 void OnConnectionError(); | |
| 73 | |
| 74 // background_sync_context_ owns this. | |
| 75 BackgroundSyncContextImpl* background_sync_context_; | |
| 76 | |
| 77 mojo::Binding<BackgroundSyncService> binding_; | |
| 78 | 67 |
| 79 // The registrations that the client might reference. | 68 // The registrations that the client might reference. |
| 80 IDMap<BackgroundSyncRegistrationHandle, | 69 IDMap<BackgroundSyncRegistrationHandle, |
| 81 IDMapOwnPointer, | 70 IDMapOwnPointer, |
| 82 BackgroundSyncRegistrationHandle::HandleId> active_handles_; | 71 BackgroundSyncRegistrationHandle::HandleId> active_handles_; |
| 83 | 72 |
| 84 base::WeakPtrFactory<BackgroundSyncServiceImpl> weak_ptr_factory_; | 73 base::WeakPtrFactory<BackgroundSyncServiceImpl> weak_ptr_factory_; |
| 85 | 74 |
| 86 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncServiceImpl); | 75 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncServiceImpl); |
| 87 }; | 76 }; |
| 88 | 77 |
| 89 } // namespace content | 78 } // namespace content |
| 90 | 79 |
| 91 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_SERVICE_IMPL_H_ | 80 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_SERVICE_IMPL_H_ |
| OLD | NEW |