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 SyncCallbacks_h | 5 #ifndef SyncCallbacks_h |
6 #define SyncCallbacks_h | 6 #define SyncCallbacks_h |
7 | 7 |
8 #include "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
9 #include "public/platform/WebCallbacks.h" | 9 #include "public/platform/WebCallbacks.h" |
10 #include "public/platform/modules/background_sync/WebSyncProvider.h" | 10 #include "public/platform/modules/background_sync/WebSyncProvider.h" |
(...skipping 10 matching lines...) Loading... |
21 struct WebSyncRegistration; | 21 struct WebSyncRegistration; |
22 class WebString; | 22 class WebString; |
23 | 23 |
24 // SyncRegistrationCallbacks is an implementation of WebSyncRegistrationCallback
s | 24 // SyncRegistrationCallbacks is an implementation of WebSyncRegistrationCallback
s |
25 // that will resolve the underlying promise depending on the result passed to | 25 // that will resolve the underlying promise depending on the result passed to |
26 // the callback. It takes a ServiceWorkerRegistration in its constructor and | 26 // the callback. It takes a ServiceWorkerRegistration in its constructor and |
27 // will pass it to the SyncRegistration. | 27 // will pass it to the SyncRegistration. |
28 class SyncRegistrationCallbacks final : public WebSyncRegistrationCallbacks { | 28 class SyncRegistrationCallbacks final : public WebSyncRegistrationCallbacks { |
29 WTF_MAKE_NONCOPYABLE(SyncRegistrationCallbacks); | 29 WTF_MAKE_NONCOPYABLE(SyncRegistrationCallbacks); |
30 public: | 30 public: |
31 SyncRegistrationCallbacks(PassRefPtrWillBeRawPtr<ScriptPromiseResolver>, Ser
viceWorkerRegistration*); | 31 SyncRegistrationCallbacks(ScriptPromiseResolver*, ServiceWorkerRegistration*
); |
32 ~SyncRegistrationCallbacks() override; | 32 ~SyncRegistrationCallbacks() override; |
33 | 33 |
34 void onSuccess(WebSyncRegistration*) override; | 34 void onSuccess(WebSyncRegistration*) override; |
35 void onError(WebSyncError*) override; | 35 void onError(WebSyncError*) override; |
36 | 36 |
37 private: | 37 private: |
38 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; | 38 Persistent<ScriptPromiseResolver> m_resolver; |
39 Persistent<ServiceWorkerRegistration> m_serviceWorkerRegistration; | 39 Persistent<ServiceWorkerRegistration> m_serviceWorkerRegistration; |
40 }; | 40 }; |
41 | 41 |
42 // SyncUnregistrationCallbacks is an implementation of | 42 // SyncUnregistrationCallbacks is an implementation of |
43 // WebSyncUnregistrationCallbacks that will resolve the underlying promise | 43 // WebSyncUnregistrationCallbacks that will resolve the underlying promise |
44 // depending on the result passed to the callback. It takes a | 44 // depending on the result passed to the callback. It takes a |
45 // ServiceWorkerRegistration in its constructor and will pass it to the | 45 // ServiceWorkerRegistration in its constructor and will pass it to the |
46 // SyncProvider. | 46 // SyncProvider. |
47 class SyncUnregistrationCallbacks final : public WebSyncUnregistrationCallbacks
{ | 47 class SyncUnregistrationCallbacks final : public WebSyncUnregistrationCallbacks
{ |
48 WTF_MAKE_NONCOPYABLE(SyncUnregistrationCallbacks); | 48 WTF_MAKE_NONCOPYABLE(SyncUnregistrationCallbacks); |
49 public: | 49 public: |
50 SyncUnregistrationCallbacks(PassRefPtrWillBeRawPtr<ScriptPromiseResolver>, S
erviceWorkerRegistration*); | 50 SyncUnregistrationCallbacks(ScriptPromiseResolver*, ServiceWorkerRegistratio
n*); |
51 ~SyncUnregistrationCallbacks() override; | 51 ~SyncUnregistrationCallbacks() override; |
52 | 52 |
53 void onSuccess(bool*) override; | 53 void onSuccess(bool*) override; |
54 void onError(WebSyncError*) override; | 54 void onError(WebSyncError*) override; |
55 | 55 |
56 private: | 56 private: |
57 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; | 57 Persistent<ScriptPromiseResolver> m_resolver; |
58 Persistent<ServiceWorkerRegistration> m_serviceWorkerRegistration; | 58 Persistent<ServiceWorkerRegistration> m_serviceWorkerRegistration; |
59 }; | 59 }; |
60 | 60 |
61 // SyncGetRegistrationsCallbacks is an implementation of WebSyncGetRegistrations
Callbacks | 61 // SyncGetRegistrationsCallbacks is an implementation of WebSyncGetRegistrations
Callbacks |
62 // that will resolve the underlying promise depending on the result passed to | 62 // that will resolve the underlying promise depending on the result passed to |
63 // the callback. It takes a ServiceWorkerRegistration in its constructor and | 63 // the callback. It takes a ServiceWorkerRegistration in its constructor and |
64 // will pass it to the SyncRegistration. | 64 // will pass it to the SyncRegistration. |
65 class SyncGetRegistrationsCallbacks final : public WebSyncGetRegistrationsCallba
cks { | 65 class SyncGetRegistrationsCallbacks final : public WebSyncGetRegistrationsCallba
cks { |
66 WTF_MAKE_NONCOPYABLE(SyncGetRegistrationsCallbacks); | 66 WTF_MAKE_NONCOPYABLE(SyncGetRegistrationsCallbacks); |
67 public: | 67 public: |
68 SyncGetRegistrationsCallbacks(PassRefPtrWillBeRawPtr<ScriptPromiseResolver>,
ServiceWorkerRegistration*); | 68 SyncGetRegistrationsCallbacks(ScriptPromiseResolver*, ServiceWorkerRegistrat
ion*); |
69 ~SyncGetRegistrationsCallbacks() override; | 69 ~SyncGetRegistrationsCallbacks() override; |
70 | 70 |
71 void onSuccess(WebVector<WebSyncRegistration*>*) override; | 71 void onSuccess(WebVector<WebSyncRegistration*>*) override; |
72 void onError(WebSyncError*) override; | 72 void onError(WebSyncError*) override; |
73 | 73 |
74 private: | 74 private: |
75 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; | 75 Persistent<ScriptPromiseResolver> m_resolver; |
76 Persistent<ServiceWorkerRegistration> m_serviceWorkerRegistration; | 76 Persistent<ServiceWorkerRegistration> m_serviceWorkerRegistration; |
77 }; | 77 }; |
78 | 78 |
79 // SyncGetPermissionStatusCallbacks is an implementation of | 79 // SyncGetPermissionStatusCallbacks is an implementation of |
80 // WebSyncGetPermissionStatusCallbacks that will resolve the underlying promise | 80 // WebSyncGetPermissionStatusCallbacks that will resolve the underlying promise |
81 // depending on the permission status passed to the callback. | 81 // depending on the permission status passed to the callback. |
82 class SyncGetPermissionStatusCallbacks final : public WebSyncGetPermissionStatus
Callbacks { | 82 class SyncGetPermissionStatusCallbacks final : public WebSyncGetPermissionStatus
Callbacks { |
83 WTF_MAKE_NONCOPYABLE(SyncGetPermissionStatusCallbacks); | 83 WTF_MAKE_NONCOPYABLE(SyncGetPermissionStatusCallbacks); |
84 public: | 84 public: |
85 SyncGetPermissionStatusCallbacks(PassRefPtrWillBeRawPtr<ScriptPromiseResolve
r>, ServiceWorkerRegistration*); | 85 SyncGetPermissionStatusCallbacks(ScriptPromiseResolver*, ServiceWorkerRegist
ration*); |
86 ~SyncGetPermissionStatusCallbacks() override; | 86 ~SyncGetPermissionStatusCallbacks() override; |
87 | 87 |
88 void onSuccess(WebSyncPermissionStatus*) override; | 88 void onSuccess(WebSyncPermissionStatus*) override; |
89 void onError(WebSyncError*) override; | 89 void onError(WebSyncError*) override; |
90 | 90 |
91 private: | 91 private: |
92 static String permissionString(WebSyncPermissionStatus); | 92 static String permissionString(WebSyncPermissionStatus); |
93 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; | 93 |
| 94 Persistent<ScriptPromiseResolver> m_resolver; |
94 Persistent<ServiceWorkerRegistration> m_serviceWorkerRegistration; | 95 Persistent<ServiceWorkerRegistration> m_serviceWorkerRegistration; |
95 }; | 96 }; |
96 | 97 |
97 } // namespace blink | 98 } // namespace blink |
98 | 99 |
99 #endif // SyncCallbacks_h | 100 #endif // SyncCallbacks_h |
OLD | NEW |