| Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
|
| diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
|
| index 16e8cbb568075711048a0339d40f36eab7b34a01..c6a257468f63b910cfc7c7a004ba1be8f4ecac37 100644
|
| --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
|
| +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
|
| @@ -153,6 +153,8 @@ Background.prototype = {
|
| * @override
|
| */
|
| setMode: function(mode, opt_injectClassic) {
|
| + console.log('setMode ' + mode + ', inject=' + opt_injectClassic);
|
| +
|
| // Switching key maps potentially affects the key codes that involve
|
| // sequencing. Without resetting this list, potentially stale key codes
|
| // remain. The key codes themselves get pushed in
|
| @@ -163,6 +165,8 @@ Background.prototype = {
|
| else
|
| cvox.ChromeVoxKbHandler.handlerKeyMap = cvox.KeyMap.fromNext();
|
|
|
| + console.log('setMode b');
|
| +
|
| if (mode == ChromeVoxMode.CLASSIC) {
|
| if (chrome.commands &&
|
| chrome.commands.onCommand.hasListener(this.onGotCommand))
|
| @@ -176,6 +180,8 @@ Background.prototype = {
|
| true, cvox.ChromeVox.isStickyPrefOn);
|
| }
|
|
|
| + console.log('setMode c');
|
| +
|
| chrome.tabs.query({active: true}, function(tabs) {
|
| if (mode === ChromeVoxMode.CLASSIC) {
|
| // Generally, we don't want to inject classic content scripts as it is
|
| @@ -193,6 +199,8 @@ Background.prototype = {
|
| }
|
| }.bind(this));
|
|
|
| + console.log('setMode d');
|
| +
|
| // If switching out of a ChromeVox Next mode, make sure we cancel
|
| // the progress loading sound just in case.
|
| if ((this.mode_ === ChromeVoxMode.NEXT ||
|
| @@ -201,6 +209,8 @@ Background.prototype = {
|
| cvox.ChromeVox.earcons.cancelEarcon(cvox.Earcon.PAGE_START_LOADING);
|
| }
|
|
|
| + console.log('setMode e');
|
| +
|
| if (mode === ChromeVoxMode.NEXT ||
|
| mode === ChromeVoxMode.FORCE_NEXT) {
|
| (new PanelCommand(PanelCommandType.ENABLE_MENUS)).send();
|
| @@ -208,6 +218,29 @@ Background.prototype = {
|
| (new PanelCommand(PanelCommandType.DISABLE_MENUS)).send();
|
| }
|
|
|
| + console.log('setMode f');
|
| +
|
| + // If switching to Classic from any automation-API-based mode,
|
| + // clear the focus ring.
|
| + if (mode === ChromeVoxMode.CLASSIC && mode != this.mode_) {
|
| + if (cvox.ChromeVox.isChromeOS)
|
| + chrome.accessibilityPrivate.setFocusRing([]);
|
| + }
|
| +
|
| + console.log('setMode g');
|
| +
|
| + // If switching away from Classic to any automation-API-based mode,
|
| + // update the range based on what's focused.
|
| + if (this.mode_ === ChromeVoxMode.CLASSIC && mode != this.mode_) {
|
| + var focus = chrome.automation.getFocus();
|
| + if (focus) {
|
| + console.log('setMode h calling setCurrentRange');
|
| + this.setCurrentRange(cursors.Range.fromNode(focus));
|
| + }
|
| + }
|
| +
|
| + console.log('setMode h');
|
| +
|
| this.mode_ = mode;
|
| },
|
|
|
| @@ -219,6 +252,8 @@ Background.prototype = {
|
| * @override
|
| */
|
| refreshMode: function(url) {
|
| + console.log('refreshMode ' + url);
|
| +
|
| var mode = this.mode_;
|
| if (mode != ChromeVoxMode.FORCE_NEXT) {
|
| if (this.isWhitelistedForNext_(url)) {
|
| @@ -499,6 +534,11 @@ Background.prototype = {
|
| // Leaving unlocalized as 'next' isn't an official name.
|
| cvox.ChromeVox.tts.speak(isClassic ?
|
| 'classic' : 'next', cvox.QueueMode.FLUSH, {doNotInterrupt: true});
|
| +
|
| + // If the new mode is Classic, return now so we don't announce
|
| + // anything more.
|
| + if (newMode == ChromeVoxMode.CLASSIC)
|
| + return false;
|
| break;
|
| case 'toggleStickyMode':
|
| cvox.ChromeVoxBackground.setPref('sticky',
|
|
|