| 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 PushPermissionStatusCallback_h | 5 #ifndef PushPermissionStatusCallback_h |
| 6 #define PushPermissionStatusCallback_h | 6 #define PushPermissionStatusCallback_h |
| 7 | 7 |
| 8 #include "public/platform/WebPushClient.h" | 8 #include "public/platform/WebPushClient.h" |
| 9 #include "public/platform/WebPushPermissionStatus.h" | 9 #include "public/platform/WebPushPermissionStatus.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 WTF { | 14 namespace WTF { |
| 15 class String; | 15 class String; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 class ScriptPromiseResolver; | 20 class ScriptPromiseResolver; |
| 21 | 21 |
| 22 // Will resolve the underlying promise depending on the permission passed to the
callback. | 22 // Will resolve the underlying promise depending on the permission passed to the
callback. |
| 23 class PushPermissionStatusCallback final : public WebPushPermissionStatusCallbac
k { | 23 class PushPermissionStatusCallback final : public WebPushPermissionStatusCallbac
k { |
| 24 WTF_MAKE_NONCOPYABLE(PushPermissionStatusCallback); | 24 WTF_MAKE_NONCOPYABLE(PushPermissionStatusCallback); |
| 25 | 25 |
| 26 public: | 26 public: |
| 27 explicit PushPermissionStatusCallback(PassRefPtr<ScriptPromiseResolver>); | 27 explicit PushPermissionStatusCallback(PassRefPtrWillBeRawPtr<ScriptPromiseRe
solver>); |
| 28 virtual ~PushPermissionStatusCallback(); | 28 virtual ~PushPermissionStatusCallback(); |
| 29 | 29 |
| 30 void onSuccess(WebPushPermissionStatus*) override; | 30 void onSuccess(WebPushPermissionStatus*) override; |
| 31 | 31 |
| 32 // Called if for some reason the status of the push permission cannot be che
cked. | 32 // Called if for some reason the status of the push permission cannot be che
cked. |
| 33 void onError() override; | 33 void onError() override; |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 static const WTF::String& permissionString(WebPushPermissionStatus); | 36 static const WTF::String& permissionString(WebPushPermissionStatus); |
| 37 RefPtr<ScriptPromiseResolver> m_resolver; | 37 RefPtrWillBeCrossThreadPersistent<ScriptPromiseResolver> m_resolver; |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 } // namespace blink | 40 } // namespace blink |
| 41 | 41 |
| 42 #endif // PushPermissionStatusCallback_h | 42 #endif // PushPermissionStatusCallback_h |
| OLD | NEW |