Index: third_party/WebKit/Source/modules/keyboard_lock/NavigatorKeyboardLock.h |
diff --git a/third_party/WebKit/Source/modules/keyboard_lock/NavigatorKeyboardLock.h b/third_party/WebKit/Source/modules/keyboard_lock/NavigatorKeyboardLock.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9bbf5de849e19ccec9abf948b4ef77d31d1f9117 |
--- /dev/null |
+++ b/third_party/WebKit/Source/modules/keyboard_lock/NavigatorKeyboardLock.h |
@@ -0,0 +1,53 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef NavigatorKeyboardLock_h |
+#define NavigatorKeyboardLock_h |
+ |
+#include "bindings/core/v8/ScriptPromise.h" |
+#include "core/frame/Navigator.h" |
+#include "platform/Supplementable.h" |
+#include "platform/heap/Handle.h" |
+#include "platform/heap/Member.h" |
+#include "public/platform/modules/keyboard_lock/keyboard_lock.mojom-blink.h" |
+#include "wtf/Forward.h" |
+ |
+namespace blink { |
+ |
+class ScriptPromiseResolver; |
+ |
+// The supplement of Navigator to process navigator.requestKeyLock() and |
+// navigator.cancelKeyLock() web APIs. This class forwards both requests |
+// directly to the browser process through mojo. |
+class NavigatorKeyboardLock final |
+ : public GarbageCollectedFinalized<NavigatorKeyboardLock>, |
foolip
2017/04/17 08:46:05
Does this need to be finalized? Is it because of t
Hzj_jie
2017/04/18 02:26:08
I believe Member<ScriptPromiseResolver> needs to b
foolip
2017/04/18 05:10:57
That shouldn't mean that all the things that hold
Hzj_jie
2017/04/19 00:45:54
Yes, it fires compiler error, but I have not remem
foolip
2017/04/21 06:08:32
Thanks for confirming. We should avoid finalized w
Hzj_jie
2017/04/22 01:20:24
Done.
|
+ public Supplement<Navigator> { |
+ USING_GARBAGE_COLLECTED_MIXIN(NavigatorKeyboardLock); |
+ |
+ public: |
+ static NavigatorKeyboardLock& From(Navigator&); |
foolip
2017/04/17 08:46:05
Does ::From need to be public given that both of t
Hzj_jie
2017/04/18 02:26:08
Done.
No, I used to believe this is a convention.
|
+ |
+ static ScriptPromise requestKeyLock(ScriptState*, |
+ Navigator&, |
+ const Vector<String>&); |
+ static void cancelKeyLock(Navigator&); |
+ |
+ DECLARE_TRACE(); |
+ |
+ private: |
+ explicit NavigatorKeyboardLock(Navigator&); |
+ static const char* SupplementName(); |
+ |
+ ScriptPromise requestKeyLock(ScriptState*, const Vector<String>&); |
+ void cancelKeyLock(); |
+ |
+ void LockRequestFinished(bool, const String&); |
+ |
+ mojom::blink::KeyboardLockServicePtr service_; |
+ Member<ScriptPromiseResolver> request_keylock_resolver_; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // NavigatorKeyboardLock_h |