OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 NavigatorKeyboardLock_h | 5 #ifndef NavigatorKeyboardLock_h |
6 #define NavigatorKeyboardLock_h | 6 #define NavigatorKeyboardLock_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "core/frame/Navigator.h" | 9 #include "core/frame/Navigator.h" |
10 #include "platform/Supplementable.h" | 10 #include "platform/Supplementable.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // page to use this API. Otherwise, web page should expect to receive the key | 32 // page to use this API. Otherwise, web page should expect to receive the key |
33 // presses once the Promise has been resolved. This API does best effort to | 33 // presses once the Promise has been resolved. This API does best effort to |
34 // deliver the key codes: due to the platform restrictions, some keys or key | 34 // deliver the key codes: due to the platform restrictions, some keys or key |
35 // combinations may not be able to receive or intercept by the user agent. | 35 // combinations may not be able to receive or intercept by the user agent. |
36 // - Making two requests concurrently without waiting for one Promise to | 36 // - Making two requests concurrently without waiting for one Promise to |
37 // finish is disallowed, the second Promise will be rejected immediately. | 37 // finish is disallowed, the second Promise will be rejected immediately. |
38 // - Making a second request after the Promise of the first one has finished | 38 // - Making a second request after the Promise of the first one has finished |
39 // is allowed; the second request will overwrite the key codes reserved. | 39 // is allowed; the second request will overwrite the key codes reserved. |
40 // - Passing in an empty keyCodes array will reserve all keys. | 40 // - Passing in an empty keyCodes array will reserve all keys. |
41 static ScriptPromise requestKeyboardLock(ScriptState*, | 41 static ScriptPromise requestKeyboardLock(ScriptState*, |
42 Navigator&, | 42 Navigator&, |
43 const Vector<String>&); | 43 const Vector<String>&); |
44 | 44 |
45 // Removes all reserved keys. This function is also asynchronized, the web | 45 // Removes all reserved keys. This function is also asynchronized, the web |
46 // page may still receive reserved keys after this function has finished. Once | 46 // page may still receive reserved keys after this function has finished. Once |
47 // the web page is closed, the user agent implicitly executes this API. | 47 // the web page is closed, the user agent implicitly executes this API. |
48 static void cancelKeyboardLock(Navigator&); | 48 static void cancelKeyboardLock(Navigator&); |
49 | 49 |
50 DECLARE_TRACE(); | 50 DECLARE_TRACE(); |
51 | 51 |
52 private: | 52 private: |
53 explicit NavigatorKeyboardLock(Navigator&); | 53 explicit NavigatorKeyboardLock(Navigator&); |
(...skipping 10 matching lines...) Expand all Loading... |
64 | 64 |
65 void LockRequestFinished(mojom::KeyboardLockRequestResult); | 65 void LockRequestFinished(mojom::KeyboardLockRequestResult); |
66 | 66 |
67 mojom::blink::KeyboardLockServicePtr service_; | 67 mojom::blink::KeyboardLockServicePtr service_; |
68 Member<ScriptPromiseResolver> request_keylock_resolver_; | 68 Member<ScriptPromiseResolver> request_keylock_resolver_; |
69 }; | 69 }; |
70 | 70 |
71 } // namespace blink | 71 } // namespace blink |
72 | 72 |
73 #endif // NavigatorKeyboardLock_h | 73 #endif // NavigatorKeyboardLock_h |
OLD | NEW |