| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 /** | 5 /** |
| 6 * @fileoverview A minimal keyboard handler. | 6 * @fileoverview A minimal keyboard handler. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 goog.provide('KeyboardHandler'); | 9 goog.provide('KeyboardHandler'); |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 // Register for Classic pref changes to get sticky mode state. | 22 // Register for Classic pref changes to get sticky mode state. |
| 23 cvox.ExtensionBridge.addMessageListener(function(msg) { | 23 cvox.ExtensionBridge.addMessageListener(function(msg) { |
| 24 if (msg['prefs']) { | 24 if (msg['prefs']) { |
| 25 var prefs = msg['prefs']; | 25 var prefs = msg['prefs']; |
| 26 cvox.ChromeVox.isStickyPrefOn = prefs['sticky'] == 'true'; | 26 cvox.ChromeVox.isStickyPrefOn = prefs['sticky'] == 'true'; |
| 27 } | 27 } |
| 28 }); | 28 }); |
| 29 | 29 |
| 30 // Make the initial request for prefs. | 30 // Make the initial request for prefs. |
| 31 cvox.ExtensionBridge.send({ | 31 cvox.ExtensionBridge.send({'target': 'Prefs', 'action': 'getPrefs'}); |
| 32 'target': 'Prefs', | |
| 33 'action': 'getPrefs' | |
| 34 }); | |
| 35 }; | 32 }; |
| 36 | 33 |
| 37 KeyboardHandler.prototype = { | 34 KeyboardHandler.prototype = { |
| 38 /** | 35 /** |
| 39 * @param {Event} evt | 36 * @param {Event} evt |
| 40 * @private | 37 * @private |
| 41 */ | 38 */ |
| 42 handleKeyDown_: function(evt) { | 39 handleKeyDown_: function(evt) { |
| 43 cvox.ExtensionBridge.send({ | 40 cvox.ExtensionBridge.send( |
| 44 'target': 'next', | 41 {'target': 'next', 'action': 'flushNextUtterance'}); |
| 45 'action': 'flushNextUtterance' | |
| 46 }); | |
| 47 | 42 |
| 48 evt.stickyMode = cvox.ChromeVox.isStickyPrefOn; | 43 evt.stickyMode = cvox.ChromeVox.isStickyPrefOn; |
| 49 | 44 |
| 50 cvox.ChromeVoxKbHandler.basicKeyDownActionsListener(evt); | 45 cvox.ChromeVoxKbHandler.basicKeyDownActionsListener(evt); |
| 51 }, | 46 }, |
| 52 | 47 |
| 53 /** | 48 /** |
| 54 * @param {string} command | 49 * @param {string} command |
| 55 * @private | 50 * @private |
| 56 */ | 51 */ |
| 57 handleCommand_: function(command) { | 52 handleCommand_: function(command) { |
| 58 cvox.ExtensionBridge.send({ | 53 cvox.ExtensionBridge.send( |
| 59 'target': 'next', | 54 {'target': 'next', 'action': 'onCommand', 'command': command}); |
| 60 'action': 'onCommand', | |
| 61 'command': command | |
| 62 }); | |
| 63 } | 55 } |
| 64 }; | 56 }; |
| OLD | NEW |