| 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 var vrShellVK = (function() { | 5 var vrShellVK = (function() { |
| 6 /** @const */ var VK_L_PANEL_LAYOUT = [ | 6 /** @const */ var VK_L_PANEL_LAYOUT = [ |
| 7 [ | 7 [ |
| 8 {'code': 'Key1', 'key': '1'}, | 8 {'code': 'Key1', 'key': '1'}, |
| 9 {'code': 'Key2', 'key': '2'}, | 9 {'code': 'Key2', 'key': '2'}, |
| 10 {'code': 'Key3', 'key': '3'}, | 10 {'code': 'Key3', 'key': '3'}, |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 vkActivateLevel(button.level); | 255 vkActivateLevel(button.level); |
| 256 } | 256 } |
| 257 | 257 |
| 258 function vkLevel0(button) { | 258 function vkLevel0(button) { |
| 259 vkCh(button); | 259 vkCh(button); |
| 260 vkActivateLevel(0); | 260 vkActivateLevel(0); |
| 261 } | 261 } |
| 262 | 262 |
| 263 function vkCh(button) { | 263 function vkCh(button) { |
| 264 if (button.key || button.code) { | 264 if (button.key || button.code) { |
| 265 // TODO(asimjour): Change the focus to the omnibox. | 265 // This code limits use of the HTML keyboard to the omnibox. |
| 266 document.querySelector("#omnibox-input-field").focus(); |
| 267 |
| 266 if (button.code != 'AltRight') | 268 if (button.code != 'AltRight') |
| 267 sendKey('key', button.code, button.key); | 269 sendKey('key', button.code, button.key); |
| 268 if (vkState.level == 1) | 270 if (vkState.level == 1) |
| 269 vkActivateLevel(0); | 271 vkActivateLevel(0); |
| 270 } | 272 } |
| 271 } | 273 } |
| 272 | 274 |
| 273 function vkOnClick(e) { | 275 function vkOnClick(e) { |
| 274 var button = e.vkButtonData; | 276 var button = e.vkButtonData; |
| 275 button.action(button); | 277 button.action(button); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 } | 430 } |
| 429 | 431 |
| 430 function sendKey(type, codeName, key) { | 432 function sendKey(type, codeName, key) { |
| 431 sendKeyEvent(type, domKeyValue(key), 0, codeName, 0); | 433 sendKeyEvent(type, domKeyValue(key), 0, codeName, 0); |
| 432 } | 434 } |
| 433 | 435 |
| 434 return {vkOnLoad: vkOnLoad}; | 436 return {vkOnLoad: vkOnLoad}; |
| 435 })(); | 437 })(); |
| 436 | 438 |
| 437 document.addEventListener('DOMContentLoaded', vrShellVK.vkOnLoad); | 439 document.addEventListener('DOMContentLoaded', vrShellVK.vkOnLoad); |
| OLD | NEW |