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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
14 #include "content/browser/background_sync/background_sync_manager.h" | 14 #include "content/browser/background_sync/background_sync_manager.h" |
15 #include "content/common/background_sync_service.mojom.h" | |
16 #include "mojo/public/cpp/bindings/binding.h" | 15 #include "mojo/public/cpp/bindings/binding.h" |
| 16 #include "third_party/WebKit/public/platform/modules/background_sync/background_
sync.mojom.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class BackgroundSyncContext; | 20 class BackgroundSyncContext; |
21 | 21 |
22 class CONTENT_EXPORT BackgroundSyncServiceImpl | 22 class CONTENT_EXPORT BackgroundSyncServiceImpl |
23 : public NON_EXPORTED_BASE(mojom::BackgroundSyncService) { | 23 : public NON_EXPORTED_BASE(blink::mojom::BackgroundSyncService) { |
24 public: | 24 public: |
25 BackgroundSyncServiceImpl( | 25 BackgroundSyncServiceImpl( |
26 BackgroundSyncContext* background_sync_context, | 26 BackgroundSyncContext* background_sync_context, |
27 mojo::InterfaceRequest<mojom::BackgroundSyncService> request); | 27 mojo::InterfaceRequest<blink::mojom::BackgroundSyncService> request); |
28 | 28 |
29 ~BackgroundSyncServiceImpl() override; | 29 ~BackgroundSyncServiceImpl() override; |
30 | 30 |
31 private: | 31 private: |
32 friend class BackgroundSyncServiceImplTest; | 32 friend class BackgroundSyncServiceImplTest; |
33 | 33 |
34 // mojom::BackgroundSyncService methods: | 34 // blink::mojom::BackgroundSyncService methods: |
35 void Register(content::mojom::SyncRegistrationPtr options, | 35 void Register(blink::mojom::SyncRegistrationPtr options, |
36 int64_t sw_registration_id, | 36 int64_t sw_registration_id, |
37 const RegisterCallback& callback) override; | 37 const RegisterCallback& callback) override; |
38 void GetRegistrations(int64_t sw_registration_id, | 38 void GetRegistrations(int64_t sw_registration_id, |
39 const GetRegistrationsCallback& callback) override; | 39 const GetRegistrationsCallback& callback) override; |
40 | 40 |
41 void OnRegisterResult(const RegisterCallback& callback, | 41 void OnRegisterResult(const RegisterCallback& callback, |
42 BackgroundSyncStatus status, | 42 BackgroundSyncStatus status, |
43 std::unique_ptr<BackgroundSyncRegistration> result); | 43 std::unique_ptr<BackgroundSyncRegistration> result); |
44 void OnGetRegistrationsResult( | 44 void OnGetRegistrationsResult( |
45 const GetRegistrationsCallback& callback, | 45 const GetRegistrationsCallback& callback, |
46 BackgroundSyncStatus status, | 46 BackgroundSyncStatus status, |
47 std::unique_ptr<ScopedVector<BackgroundSyncRegistration>> result); | 47 std::unique_ptr<ScopedVector<BackgroundSyncRegistration>> result); |
48 | 48 |
49 // Called when an error is detected on binding_. | 49 // Called when an error is detected on binding_. |
50 void OnConnectionError(); | 50 void OnConnectionError(); |
51 | 51 |
52 // background_sync_context_ owns this. | 52 // background_sync_context_ owns this. |
53 BackgroundSyncContext* background_sync_context_; | 53 BackgroundSyncContext* background_sync_context_; |
54 | 54 |
55 mojo::Binding<mojom::BackgroundSyncService> binding_; | 55 mojo::Binding<blink::mojom::BackgroundSyncService> binding_; |
56 | 56 |
57 base::WeakPtrFactory<BackgroundSyncServiceImpl> weak_ptr_factory_; | 57 base::WeakPtrFactory<BackgroundSyncServiceImpl> weak_ptr_factory_; |
58 | 58 |
59 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncServiceImpl); | 59 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncServiceImpl); |
60 }; | 60 }; |
61 | 61 |
62 } // namespace content | 62 } // namespace content |
63 | 63 |
64 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_SERVICE_IMPL_H_ | 64 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_SERVICE_IMPL_H_ |
OLD | NEW |