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 /** | 5 /** |
6 * @fileoverview Chrome-specific implementation of methods that differ | 6 * @fileoverview Chrome-specific implementation of methods that differ |
7 * depending on the host platform. | 7 * depending on the host platform. |
8 * | 8 * |
9 */ | 9 */ |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 var prefs = message['prefs']; | 54 var prefs = message['prefs']; |
55 cvox.ChromeVoxEditableTextBase.useIBeamCursor = | 55 cvox.ChromeVoxEditableTextBase.useIBeamCursor = |
56 (prefs['useIBeamCursor'] == 'true'); | 56 (prefs['useIBeamCursor'] == 'true'); |
57 cvox.ChromeVoxEditableTextBase.eventTypingEcho = true; | 57 cvox.ChromeVoxEditableTextBase.eventTypingEcho = true; |
58 cvox.ChromeVoxEventWatcher.focusFollowsMouse = | 58 cvox.ChromeVoxEventWatcher.focusFollowsMouse = |
59 (prefs['focusFollowsMouse'] == 'true'); | 59 (prefs['focusFollowsMouse'] == 'true'); |
60 | 60 |
61 cvox.ChromeVox.version = prefs['version']; | 61 cvox.ChromeVox.version = prefs['version']; |
62 | 62 |
63 cvox.ChromeVox.typingEcho = | 63 cvox.ChromeVox.typingEcho = |
64 /** @type {number} */(JSON.parse(prefs['typingEcho'])); | 64 /** @type {number} */ (JSON.parse(prefs['typingEcho'])); |
65 | 65 |
66 if (prefs['position']) { | 66 if (prefs['position']) { |
67 cvox.ChromeVox.position = | 67 cvox.ChromeVox.position = |
68 /** @type {Object<{x:number, y:number}>} */ ( | 68 /** @type {Object<{x:number, y:number}>} */ ( |
69 JSON.parse(prefs['position'])); | 69 JSON.parse(prefs['position'])); |
70 } | 70 } |
71 | 71 |
72 if (prefs['granularity'] != 'undefined') { | 72 if (prefs['granularity'] != 'undefined') { |
73 cvox.ChromeVox.navigationManager.setGranularity( | 73 cvox.ChromeVox.navigationManager.setGranularity( |
74 /** @type {number} */ (JSON.parse(prefs['granularity']))); | 74 /** @type {number} */ (JSON.parse(prefs['granularity']))); |
(...skipping 18 matching lines...) Expand all Loading... |
93 cvox.BrailleOverlayWidget.getInstance().setActive( | 93 cvox.BrailleOverlayWidget.getInstance().setActive( |
94 prefs['brailleCaptions'] == 'true'); | 94 prefs['brailleCaptions'] == 'true'); |
95 } | 95 } |
96 }; | 96 }; |
97 cvox.ExtensionBridge.addMessageListener(listener); | 97 cvox.ExtensionBridge.addMessageListener(listener); |
98 | 98 |
99 cvox.ExtensionBridge.addMessageListener(function(msg, port) { | 99 cvox.ExtensionBridge.addMessageListener(function(msg, port) { |
100 if (msg['message'] == 'DOMAINS_STYLES') { | 100 if (msg['message'] == 'DOMAINS_STYLES') { |
101 cvox.TraverseMath.getInstance().addDomainsAndStyles( | 101 cvox.TraverseMath.getInstance().addDomainsAndStyles( |
102 msg['domains'], msg['styles']); | 102 msg['domains'], msg['styles']); |
103 }}); | 103 } |
| 104 }); |
104 | 105 |
105 cvox.ExtensionBridge.addMessageListener(function(msg, port) { | 106 cvox.ExtensionBridge.addMessageListener(function(msg, port) { |
106 var message = msg['message']; | 107 var message = msg['message']; |
107 var cmd = msg['command']; | 108 var cmd = msg['command']; |
108 if (message == 'USER_COMMAND') { | 109 if (message == 'USER_COMMAND') { |
109 if (cmd != 'toggleChromeVox' && !cvox.ChromeVox.documentHasFocus()) { | 110 if (cmd != 'toggleChromeVox' && !cvox.ChromeVox.documentHasFocus()) { |
110 return; | 111 return; |
111 } | 112 } |
112 cvox.ChromeVoxUserCommands.commands[cmd](msg); | 113 cvox.ChromeVoxUserCommands.commands[cmd](msg); |
113 } else if (message == 'SYSTEM_COMMAND') { | 114 } else if (message == 'SYSTEM_COMMAND') { |
114 if (cmd == 'killChromeVox') { | 115 if (cmd == 'killChromeVox') { |
115 var reStr = msg['excludeUrlRegExp']; | 116 var reStr = msg['excludeUrlRegExp']; |
116 if (reStr && new RegExp(reStr).test(location.href)) { | 117 if (reStr && new RegExp(reStr).test(location.href)) { |
117 return; | 118 return; |
118 } | 119 } |
119 this.killChromeVox(); | 120 this.killChromeVox(); |
120 } | 121 } |
121 } | 122 } |
122 }.bind(this)); | 123 }.bind(this)); |
123 | 124 |
124 cvox.ExtensionBridge.send({ | 125 cvox.ExtensionBridge.send({'target': 'Prefs', 'action': 'getPrefs'}); |
125 'target': 'Prefs', | |
126 'action': 'getPrefs' | |
127 }); | |
128 | 126 |
129 cvox.ExtensionBridge.send({ | 127 cvox.ExtensionBridge.send({'target': 'Data', 'action': 'getHistory'}); |
130 'target': 'Data', | |
131 'action': 'getHistory' | |
132 }); | |
133 }; | 128 }; |
134 | 129 |
135 | 130 |
136 /** @override */ | 131 /** @override */ |
137 cvox.ChromeHost.prototype.reinit = function() { | 132 cvox.ChromeHost.prototype.reinit = function() { |
138 cvox.ExtensionBridge.init(); | 133 cvox.ExtensionBridge.init(); |
139 }; | 134 }; |
140 | 135 |
141 | 136 |
142 /** @override */ | 137 /** @override */ |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 * @param {boolean} sticky Whether sticky mode should be active. | 176 * @param {boolean} sticky Whether sticky mode should be active. |
182 */ | 177 */ |
183 cvox.ChromeHost.prototype.activateOrDeactivateStickyMode = function(sticky) { | 178 cvox.ChromeHost.prototype.activateOrDeactivateStickyMode = function(sticky) { |
184 cvox.ChromeVox.isStickyPrefOn = sticky; | 179 cvox.ChromeVox.isStickyPrefOn = sticky; |
185 }; | 180 }; |
186 | 181 |
187 /** | 182 /** |
188 * The host constructor for Chrome. | 183 * The host constructor for Chrome. |
189 */ | 184 */ |
190 cvox.HostFactory.hostConstructor = cvox.ChromeHost; | 185 cvox.HostFactory.hostConstructor = cvox.ChromeHost; |
OLD | NEW |