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