OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 NavigatorKeyboardLock_h |
| 6 #define NavigatorKeyboardLock_h |
| 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "core/frame/Navigator.h" |
| 10 #include "platform/Supplementable.h" |
| 11 #include "platform/heap/Handle.h" |
| 12 #include "platform/heap/Member.h" |
| 13 #include "public/platform/modules/keyboard_lock/keyboard_lock.mojom-blink.h" |
| 14 #include "wtf/Forward.h" |
| 15 |
| 16 namespace blink { |
| 17 |
| 18 class ScriptPromiseResolver; |
| 19 |
| 20 // The supplement of Navigator to process navigator.requestKeyLock() and |
| 21 // navigator.cancelKeyLock() web APIs. This class forwards both requests |
| 22 // directly to the browser process through mojo. |
| 23 class NavigatorKeyboardLock final |
| 24 : public GarbageCollectedFinalized<NavigatorKeyboardLock>, |
| 25 public Supplement<Navigator> { |
| 26 USING_GARBAGE_COLLECTED_MIXIN(NavigatorKeyboardLock); |
| 27 |
| 28 public: |
| 29 static NavigatorKeyboardLock& From(Navigator&); |
| 30 |
| 31 static ScriptPromise requestKeyLock(ScriptState*, |
| 32 Navigator&, |
| 33 const Vector<String>&); |
| 34 static void cancelKeyLock(Navigator&); |
| 35 |
| 36 DECLARE_TRACE(); |
| 37 |
| 38 private: |
| 39 explicit NavigatorKeyboardLock(Navigator&); |
| 40 static const char* SupplementName(); |
| 41 |
| 42 ScriptPromise requestKeyLock(ScriptState*, const Vector<String>&); |
| 43 void cancelKeyLock(); |
| 44 |
| 45 void LockRequestFinished(bool, const String&); |
| 46 |
| 47 mojom::blink::KeyboardLockServicePtr service_; |
| 48 Member<ScriptPromiseResolver> request_keylock_resolver_; |
| 49 }; |
| 50 |
| 51 } // namespace blink |
| 52 |
| 53 #endif // NavigatorKeyboardLock_h |
OLD | NEW |