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>, | |
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.
| |
25 public Supplement<Navigator> { | |
26 USING_GARBAGE_COLLECTED_MIXIN(NavigatorKeyboardLock); | |
27 | |
28 public: | |
29 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.
| |
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 |