Chromium Code Reviews| 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 bea4f4861f4d40f687adb3beedb014c5bde4c56c..07c903259303f39e870ad465511443265282568c 100644 |
| --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js |
| +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js |
| @@ -126,6 +126,10 @@ Background = function() { |
| if (!chrome.accessibilityPrivate.setKeyboardListener) |
| chrome.accessibilityPrivate.setKeyboardListener = function() {}; |
| + |
| + var focus = chrome.automation.getFocus(); |
| + if (focus) |
| + this.setCurrentRange(cursors.Range.fromNode(focus)); |
| }; |
| Background.prototype = { |
| @@ -190,6 +194,21 @@ Background.prototype = { |
| cvox.ChromeVox.earcons.cancelEarcon(cvox.Earcon.PAGE_START_LOADING); |
| } |
| + // 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([]); |
| + } |
| + |
| + // 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) |
| + this.setCurrentRange(cursors.Range.fromNode(focus)); |
| + } |
| + |
| this.mode_ = mode; |
| }, |
| @@ -465,6 +484,12 @@ 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 |
|
David Tseng
2016/01/28 02:00:56
Maybe add something to queue the next utterance?
dmazzoni
2016/01/30 00:02:41
For Classic? Did you have something specific in mi
|
| + // anything more. |
| + if (newMode == ChromeVoxMode.CLASSIC) |
| + return false; |
| + |
|
David Tseng
2016/01/28 02:00:56
nit: extra line
dmazzoni
2016/01/30 00:02:41
Done.
|
| break; |
| case 'toggleStickyMode': |
| cvox.ChromeVoxBackground.setPref('sticky', |