| 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 The entry point for all ChromeVox2 related code for the | 6 * @fileoverview The entry point for all ChromeVox2 related code for the |
| 7 * background page. | 7 * background page. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 goog.provide('Background'); | 10 goog.provide('Background'); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 /** | 163 /** |
| 164 * @override | 164 * @override |
| 165 */ | 165 */ |
| 166 setMode: function(mode, opt_injectClassic) { | 166 setMode: function(mode, opt_injectClassic) { |
| 167 // Switching key maps potentially affects the key codes that involve | 167 // Switching key maps potentially affects the key codes that involve |
| 168 // sequencing. Without resetting this list, potentially stale key codes | 168 // sequencing. Without resetting this list, potentially stale key codes |
| 169 // remain. The key codes themselves get pushed in | 169 // remain. The key codes themselves get pushed in |
| 170 // cvox.KeySequence.deserialize which gets called by cvox.KeyMap. | 170 // cvox.KeySequence.deserialize which gets called by cvox.KeyMap. |
| 171 cvox.ChromeVox.sequenceSwitchKeyCodes = []; | 171 cvox.ChromeVox.sequenceSwitchKeyCodes = []; |
| 172 if (mode === ChromeVoxMode.CLASSIC || mode === ChromeVoxMode.COMPAT) | 172 if (mode === ChromeVoxMode.CLASSIC || mode === ChromeVoxMode.COMPAT) |
| 173 cvox.ChromeVoxKbHandler.handlerKeyMap = cvox.KeyMap.fromDefaults(); | 173 window['prefs'].switchToKeyMap('keymap_classic'); |
| 174 else | 174 else |
| 175 cvox.ChromeVoxKbHandler.handlerKeyMap = cvox.KeyMap.fromNext(); | 175 window['prefs'].switchToKeyMap('keymap_next'); |
| 176 | 176 |
| 177 if (mode == ChromeVoxMode.CLASSIC) { | 177 if (mode == ChromeVoxMode.CLASSIC) { |
| 178 if (chrome.commands && | 178 if (chrome.commands && |
| 179 chrome.commands.onCommand.hasListener(this.onGotCommand)) | 179 chrome.commands.onCommand.hasListener(this.onGotCommand)) |
| 180 chrome.commands.onCommand.removeListener(this.onGotCommand); | 180 chrome.commands.onCommand.removeListener(this.onGotCommand); |
| 181 chrome.accessibilityPrivate.setKeyboardListener(false, false); | 181 chrome.accessibilityPrivate.setKeyboardListener(false, false); |
| 182 } else { | 182 } else { |
| 183 if (chrome.commands && | 183 if (chrome.commands && |
| 184 !chrome.commands.onCommand.hasListener(this.onGotCommand)) | 184 !chrome.commands.onCommand.hasListener(this.onGotCommand)) |
| 185 chrome.commands.onCommand.addListener(this.onGotCommand); | 185 chrome.commands.onCommand.addListener(this.onGotCommand); |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') | 989 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') |
| 990 .replace(/\*/g, '.*') | 990 .replace(/\*/g, '.*') |
| 991 .replace(/\?/g, '.'); | 991 .replace(/\?/g, '.'); |
| 992 }).join('|') + ')$'); | 992 }).join('|') + ')$'); |
| 993 }; | 993 }; |
| 994 | 994 |
| 995 /** @type {Background} */ | 995 /** @type {Background} */ |
| 996 global.backgroundObj = new Background(); | 996 global.backgroundObj = new Background(); |
| 997 | 997 |
| 998 }); // goog.scope | 998 }); // goog.scope |
| OLD | NEW |