Chromium Code Reviews| 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 to implement | |
| 7 // https://garykac.github.io/system-keyboard-lock/. | |
|
foolip
2017/04/17 08:46:05
Just a link to the spec will suffice, most IDL fil
Hzj_jie
2017/04/18 02:26:08
Done.
| |
| 8 partial interface Navigator { | |
| 9 // Requests to receive a set of key codes | |
|
foolip
2017/04/17 08:46:05
Please copy the spec'd IDL verbatim and make the m
Hzj_jie
2017/04/18 02:26:08
Done.
| |
| 10 // (https://www.w3.org/TR/uievents/#interface-keyboardevent) in string | |
| 11 // format. | |
| 12 // The Promise will be rejected if the user or browser do not allow the web | |
| 13 // page to use this API. Otherwise, web page should expect to receive the | |
| 14 // key presses once the Promise has been resolved. This API does best effort | |
| 15 // to deliver the key codes: due to the platform restrictions, some keys or | |
| 16 // key combinations may not be able to receive or intercept by the user | |
| 17 // agent. | |
| 18 // - Making two requests concurrently without waiting for one Promise to | |
| 19 // finish is disallowed, the second Promise will be rejected immediately. | |
| 20 // - Making a second request after the Promise of the first one has finished | |
| 21 // is allowed; the second request will overwrite the key codes reserved. | |
| 22 // - Passing in an empty keyCodes array will reserve all keys. | |
| 23 [RuntimeEnabled=KeyboardLock, CallWith=ScriptState] Promise<void> requestKey Lock(DOMString[] keyCodes); | |
|
foolip
2017/04/17 08:46:05
The argument should be "optional sequence<DOMStrin
Hzj_jie
2017/04/18 02:26:08
Passing in an empty keyCodes array will reserve al
foolip
2017/04/18 05:10:57
OK. In that case it probably makes sense to add "
Hzj_jie
2017/04/19 00:45:54
Updated.
TODOs have been added, and point to the c
| |
| 24 | |
| 25 // Removes all reserved keys. This function is also asynchronized, the web | |
| 26 // page may still receive reserved keys after this function has finished. | |
| 27 // Once the web page is closed, the user agent implictly executes this API. | |
|
foolip
2017/04/17 08:46:05
Is such an implicit call anywhere in the code?
Hzj_jie
2017/04/18 02:26:08
Yes, the logic is in browser process, which has no
foolip
2017/04/18 05:10:57
The spec should probably define precisely which ev
Hzj_jie
2017/04/19 00:45:54
Done.
TODO has been added, and point to the corres
| |
| 28 [RuntimeEnabled=KeyboardLock] void cancelKeyLock(); | |
| 29 }; | |
| OLD | NEW |