OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 PushRegistrationCallbacks_h | 5 #ifndef PushSubscriptionCallbacks_h |
6 #define PushRegistrationCallbacks_h | 6 #define PushSubscriptionCallbacks_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 "wtf/Noncopyable.h" | 10 #include "wtf/Noncopyable.h" |
11 #include "wtf/PassRefPtr.h" | 11 #include "wtf/PassRefPtr.h" |
12 #include "wtf/RefPtr.h" | 12 #include "wtf/RefPtr.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class ServiceWorkerRegistration; | 16 class ServiceWorkerRegistration; |
17 class ScriptPromiseResolver; | 17 class ScriptPromiseResolver; |
18 struct WebPushError; | 18 struct WebPushError; |
19 struct WebPushRegistration; | 19 struct WebPushSubscription; |
20 | 20 |
21 // PushRegistrationCallbacks is an implementation of WebPushRegistrationCallback
s | 21 // PushSubscriptionCallbacks is an implementation of WebPushSubscriptionCallback
s |
22 // that will resolve the underlying promise depending on the result passed to | 22 // that will resolve the underlying promise depending on the result passed to |
23 // the callback. It takes a ServiceWorkerRegistration in its constructor and | 23 // the callback. It takes a ServiceWorkerRegistration in its constructor and |
24 // will pass it to the PushRegistration. | 24 // will pass it to the PushSubscription. |
25 class PushRegistrationCallbacks final : public WebCallbacks<WebPushRegistration,
WebPushError> { | 25 class PushSubscriptionCallbacks final : public WebCallbacks<WebPushSubscription,
WebPushError> { |
26 WTF_MAKE_NONCOPYABLE(PushRegistrationCallbacks); | 26 WTF_MAKE_NONCOPYABLE(PushSubscriptionCallbacks); |
27 public: | 27 public: |
28 PushRegistrationCallbacks(PassRefPtrWillBeRawPtr<ScriptPromiseResolver>, Ser
viceWorkerRegistration*); | 28 PushSubscriptionCallbacks(PassRefPtrWillBeRawPtr<ScriptPromiseResolver>, Ser
viceWorkerRegistration*); |
29 ~PushRegistrationCallbacks() override; | 29 ~PushSubscriptionCallbacks() override; |
30 | 30 |
31 void onSuccess(WebPushRegistration*) override; | 31 void onSuccess(WebPushSubscription*) override; |
32 void onError(WebPushError*) override; | 32 void onError(WebPushError*) override; |
33 | 33 |
34 private: | 34 private: |
35 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; | 35 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; |
36 Persistent<ServiceWorkerRegistration> m_serviceWorkerRegistration; | 36 Persistent<ServiceWorkerRegistration> m_serviceWorkerRegistration; |
37 }; | 37 }; |
38 | 38 |
39 } // namespace blink | 39 } // namespace blink |
40 | 40 |
41 #endif // PushRegistrationCallbacks_h | 41 #endif // PushSubscriptionCallbacks_h |
OLD | NEW |