OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 goog.provide('cvox.ChromeVoxKbHandler'); | 5 goog.provide('cvox.ChromeVoxKbHandler'); |
6 | 6 |
7 goog.require('cvox.ChromeVox'); | 7 goog.require('cvox.ChromeVox'); |
8 goog.require('cvox.ChromeVoxUserCommands'); | 8 goog.require('cvox.ChromeVoxUserCommands'); |
9 goog.require('cvox.History'); | 9 goog.require('cvox.History'); |
10 goog.require('cvox.KeyMap'); | 10 goog.require('cvox.KeyMap'); |
(...skipping 26 matching lines...) Expand all Loading... |
37 } | 37 } |
38 | 38 |
39 cvox.ChromeVoxKbHandler.handlerKeyMap = | 39 cvox.ChromeVoxKbHandler.handlerKeyMap = |
40 cvox.KeyMap.fromJSON(keyToFunctionsTable); | 40 cvox.KeyMap.fromJSON(keyToFunctionsTable); |
41 }; | 41 }; |
42 | 42 |
43 /** | 43 /** |
44 * Converts the key bindings table into an array that is sorted by the lengths | 44 * Converts the key bindings table into an array that is sorted by the lengths |
45 * of the key bindings. After the sort, the key bindings that describe single | 45 * of the key bindings. After the sort, the key bindings that describe single |
46 * keys will come before the key bindings that describe multiple keys. | 46 * keys will come before the key bindings that describe multiple keys. |
47 * @param {Object.<string, string>} keyToFunctionsTable Contains each key | 47 * @param {Object<string, string>} keyToFunctionsTable Contains each key |
48 * binding and its associated function name. | 48 * binding and its associated function name. |
49 * @return {Array.<Array.<string>>} The sorted key bindings table in | 49 * @return {Array<Array<string>>} The sorted key bindings table in |
50 * array form. Each entry in the array is itself an array containing the | 50 * array form. Each entry in the array is itself an array containing the |
51 * key binding and its associated function name. | 51 * key binding and its associated function name. |
52 * @private | 52 * @private |
53 */ | 53 */ |
54 cvox.ChromeVoxKbHandler.sortKeyToFunctionsTable_ = function( | 54 cvox.ChromeVoxKbHandler.sortKeyToFunctionsTable_ = function( |
55 keyToFunctionsTable) { | 55 keyToFunctionsTable) { |
56 var sortingArray = []; | 56 var sortingArray = []; |
57 | 57 |
58 for (var keySeqStr in keyToFunctionsTable) { | 58 for (var keySeqStr in keyToFunctionsTable) { |
59 sortingArray.push([keySeqStr, keyToFunctionsTable[keySeqStr]]); | 59 sortingArray.push([keySeqStr, keyToFunctionsTable[keySeqStr]]); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 returnValue = false; | 122 returnValue = false; |
123 } | 123 } |
124 | 124 |
125 // If the whole document is hidden from screen readers, let the app | 125 // If the whole document is hidden from screen readers, let the app |
126 // catch keys as well. | 126 // catch keys as well. |
127 if (cvox.ChromeVox.entireDocumentIsHidden) { | 127 if (cvox.ChromeVox.entireDocumentIsHidden) { |
128 returnValue = true; | 128 returnValue = true; |
129 } | 129 } |
130 return returnValue; | 130 return returnValue; |
131 }; | 131 }; |
OLD | NEW |