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