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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 }); | 574 }); |
575 }, | 575 }, |
576 | 576 |
577 /** | 577 /** |
578 * Sets the current ChromeVox mode. | 578 * Sets the current ChromeVox mode. |
579 * @param {ChromeVoxMode} mode | 579 * @param {ChromeVoxMode} mode |
580 * @param {boolean=} opt_injectClassic Injects ChromeVox classic into tabs; | 580 * @param {boolean=} opt_injectClassic Injects ChromeVox classic into tabs; |
581 * defaults to false. | 581 * defaults to false. |
582 */ | 582 */ |
583 setChromeVoxMode: function(mode, opt_injectClassic) { | 583 setChromeVoxMode: function(mode, opt_injectClassic) { |
| 584 // Switching key maps potentially affects the key codes that involve |
| 585 // sequencing. Without resetting this list, potentially stale key codes |
| 586 // remain. The key codes themselves get pushed in |
| 587 // cvox.KeySequence.deserialize which gets called by cvox.KeyMap. |
| 588 cvox.ChromeVox.sequenceSwitchKeyCodes = []; |
584 if (mode === ChromeVoxMode.CLASSIC || mode === ChromeVoxMode.COMPAT) | 589 if (mode === ChromeVoxMode.CLASSIC || mode === ChromeVoxMode.COMPAT) |
585 cvox.ChromeVoxKbHandler.handlerKeyMap = cvox.KeyMap.fromDefaults(); | 590 cvox.ChromeVoxKbHandler.handlerKeyMap = cvox.KeyMap.fromDefaults(); |
586 else | 591 else |
587 cvox.ChromeVoxKbHandler.handlerKeyMap = cvox.KeyMap.fromNext(); | 592 cvox.ChromeVoxKbHandler.handlerKeyMap = cvox.KeyMap.fromNext(); |
588 | 593 |
589 if (mode == ChromeVoxMode.CLASSIC) { | 594 if (mode == ChromeVoxMode.CLASSIC) { |
590 if (chrome.commands && | 595 if (chrome.commands && |
591 chrome.commands.onCommand.hasListener(this.onGotCommand)) | 596 chrome.commands.onCommand.hasListener(this.onGotCommand)) |
592 chrome.commands.onCommand.removeListener(this.onGotCommand); | 597 chrome.commands.onCommand.removeListener(this.onGotCommand); |
593 } else { | 598 } else { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') | 687 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') |
683 .replace(/\*/g, '.*') | 688 .replace(/\*/g, '.*') |
684 .replace(/\?/g, '.'); | 689 .replace(/\?/g, '.'); |
685 }).join('|') + ')$'); | 690 }).join('|') + ')$'); |
686 }; | 691 }; |
687 | 692 |
688 /** @type {Background} */ | 693 /** @type {Background} */ |
689 global.backgroundObj = new Background(); | 694 global.backgroundObj = new Background(); |
690 | 695 |
691 }); // goog.scope | 696 }); // goog.scope |
OLD | NEW |