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 PushPermissionStatusCallbacks_h | 5 #ifndef PushPermissionStatusCallbacks_h |
6 #define PushPermissionStatusCallbacks_h | 6 #define PushPermissionStatusCallbacks_h |
7 | 7 |
8 #include "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
9 #include "public/platform/modules/push_messaging/WebPushPermissionStatus.h" | 9 #include "public/platform/modules/push_messaging/WebPushPermissionStatus.h" |
10 #include "public/platform/modules/push_messaging/WebPushProvider.h" | 10 #include "public/platform/modules/push_messaging/WebPushProvider.h" |
11 #include "wtf/Noncopyable.h" | 11 #include "wtf/Noncopyable.h" |
12 #include "wtf/PassRefPtr.h" | 12 #include "wtf/PassRefPtr.h" |
13 #include "wtf/RefPtr.h" | 13 #include "wtf/RefPtr.h" |
14 | 14 |
15 namespace WTF { | 15 namespace WTF { |
16 class String; | 16 class String; |
17 } | 17 } |
18 | 18 |
19 namespace blink { | 19 namespace blink { |
20 | 20 |
21 class ScriptPromiseResolver; | 21 class ScriptPromiseResolver; |
22 | 22 |
23 // Will resolve the underlying promise depending on the permission received. | 23 // Will resolve the underlying promise depending on the permission received. |
24 class PushPermissionStatusCallbacks final : public WebPushPermissionStatusCallba
cks { | 24 class PushPermissionStatusCallbacks final : public WebPushPermissionStatusCallba
cks { |
25 WTF_MAKE_NONCOPYABLE(PushPermissionStatusCallbacks); | 25 WTF_MAKE_NONCOPYABLE(PushPermissionStatusCallbacks); |
26 | 26 |
27 public: | 27 public: |
28 explicit PushPermissionStatusCallbacks(PassRefPtrWillBeRawPtr<ScriptPromiseR
esolver>); | 28 explicit PushPermissionStatusCallbacks(PassRefPtrWillBeRawPtr<ScriptPromiseR
esolver>); |
29 virtual ~PushPermissionStatusCallbacks(); | 29 ~PushPermissionStatusCallbacks() override; |
30 | 30 |
31 void onSuccess(WebPushPermissionStatus*) override; | 31 void onSuccess(WebPushPermissionStatus*) override; |
32 | 32 |
33 // Called if for some reason the status of the push permission cannot be che
cked. | 33 // Called if for some reason the status of the push permission cannot be che
cked. |
34 void onError(WebPushError*) override; | 34 void onError(WebPushError*) override; |
35 | 35 |
36 private: | 36 private: |
37 static WTF::String permissionString(WebPushPermissionStatus); | 37 static WTF::String permissionString(WebPushPermissionStatus); |
38 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; | 38 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; |
39 }; | 39 }; |
40 | 40 |
41 } // namespace blink | 41 } // namespace blink |
42 | 42 |
43 #endif // PushPermissionStatusCallbacks_h | 43 #endif // PushPermissionStatusCallbacks_h |
OLD | NEW |