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