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 // The supplement of Navigator to process navigator.requestKeyLock() and |
| 6 // navigator.cancelKeyLock() web APIs. See http://crbug.com/680809. |
| 7 partial interface Navigator { |
| 8 // Requests to receive a set of key codes |
| 9 // (https://www.w3.org/TR/uievents/#interface-keyboardevent) in string |
| 10 // format. |
| 11 // The Promise will be rejected if the user or browser do not allow the web |
| 12 // page to use this API. Otherwise, web page should expect to receive the |
| 13 // key presses once the Promise has been resolved. This API does best effort |
| 14 // to deliver the key codes: due to the platform restrictions, some keys or |
| 15 // key combinations may not be able to receive or intercept by the user |
| 16 // agent. |
| 17 // - Making two requests concurrently without waiting for one Promise to |
| 18 // finish is disallowed, the second Promise will be rejected immediately. |
| 19 // - Making a second request after the Promise of the first one has finished |
| 20 // is allowed; the second request will overwrite the key codes reserved. |
| 21 // - Passing in an empty keyCodes array will reserve all keys. |
| 22 [RuntimeEnabled=KeyboardLock, CallWith=ScriptState] Promise<void> requestKey
Lock(DOMString[] keyCodes); |
| 23 |
| 24 // Removes all reserved keys. This function is also asynchronized, the web |
| 25 // page may still receive reserved keys after this function has finished. |
| 26 // Once the web page is closed, the user agent implictly executes this API. |
| 27 [RuntimeEnabled=KeyboardLock] void cancelKeyLock(); |
| 28 }; |
OLD | NEW |