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 PermissionCallback_h | 5 #ifndef PermissionCallback_h |
6 #define PermissionCallback_h | 6 #define PermissionCallback_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/modules/permissions/WebPermissionClient.h" |
10 #include "public/platform/modules/permissions/WebPermissionStatus.h" | 10 #include "public/platform/modules/permissions/WebPermissionStatus.h" |
11 #include "public/platform/modules/permissions/WebPermissionType.h" | 11 #include "public/platform/modules/permissions/WebPermissionType.h" |
12 #include "wtf/Noncopyable.h" | 12 #include "wtf/Noncopyable.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class ScriptPromiseResolver; | 16 class ScriptPromiseResolver; |
17 | 17 |
18 // PermissionQueryCallback is an implementation of WebPermissionCallbacks | 18 // PermissionQueryCallback is an implementation of WebPermissionCallbacks |
19 // that will resolve the underlying promise depending on the result passed to | 19 // that will resolve the underlying promise depending on the result passed to |
20 // the callback. It takes a WebPermissionType in its constructor and will pass | 20 // the callback. It takes a WebPermissionType in its constructor and will pass |
21 // it to the PermissionStatus. | 21 // it to the PermissionStatus. |
22 class PermissionCallback final | 22 class PermissionCallback final : public WebPermissionCallback { |
23 : public WebCallbacks<WebPermissionStatus*, void> { | |
24 public: | 23 public: |
25 PermissionCallback(ScriptPromiseResolver*, WebPermissionType); | 24 PermissionCallback(ScriptPromiseResolver*, WebPermissionType); |
26 ~PermissionCallback() override; | 25 ~PermissionCallback() override; |
27 | 26 |
28 void onSuccess(WebPermissionStatus*) override; | 27 void onSuccess(WebPermissionStatus) override; |
29 void onError() override; | 28 void onError() override; |
30 | 29 |
31 private: | 30 private: |
32 Persistent<ScriptPromiseResolver> m_resolver; | 31 Persistent<ScriptPromiseResolver> m_resolver; |
33 WebPermissionType m_permissionType; | 32 WebPermissionType m_permissionType; |
34 | 33 |
35 WTF_MAKE_NONCOPYABLE(PermissionCallback); | 34 WTF_MAKE_NONCOPYABLE(PermissionCallback); |
36 }; | 35 }; |
37 | 36 |
38 } // namespace blink | 37 } // namespace blink |
39 | 38 |
40 #endif // PermissionCallback_h | 39 #endif // PermissionCallback_h |
OLD | NEW |