Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6410)

Unified Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js

Issue 1213513003: Revert of Support Compat mode inside of the desktop tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@commands_alt
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 59b90f3eff34d8e48cd0b3e79df51033f093962e..8d988b54ca49e5997c65452d90f75533081629ee 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
@@ -61,7 +61,7 @@
this.mode_ = ChromeVoxMode.CLASSIC;
/** @type {!ClassicCompatibility} @private */
- this.compat_ = new ClassicCompatibility();
+ this.compat_ = new ClassicCompatibility(this.mode_ === ChromeVoxMode.COMPAT);
// Manually bind all functions to |this|.
for (var func in this) {
@@ -86,6 +86,8 @@
valueChanged: this.onValueChanged
};
+ // Register listeners for ...
+ // Desktop.
chrome.automation.getDesktop(this.onGotDesktop);
};
@@ -125,14 +127,17 @@
* @param {string} command
* @param {boolean=} opt_skipCompat Whether to skip compatibility checks.
*/
- onGotCommand: function(command, opt_skipCompat) {
+ onGotCommand: function(command, opt_skipCompat) {
if (!this.currentRange_)
return;
- if (!opt_skipCompat && this.mode_ === ChromeVoxMode.COMPAT) {
+ if (!opt_skipCompat) {
if (this.compat_.onGotCommand(command))
return;
}
+
+ if (this.mode_ === ChromeVoxMode.CLASSIC)
+ return;
var current = this.currentRange_;
var dir = Dir.FORWARD;
@@ -323,14 +328,10 @@
if (current) {
// TODO(dtseng): Figure out what it means to focus a range.
- var actionNode = current.getStart().getNode();
- if (actionNode.role == chrome.automation.RoleType.inlineTextBox)
- actionNode = actionNode.parent;
- actionNode.focus();
+ current.getStart().getNode().focus();
var prevRange = this.currentRange_;
this.currentRange_ = current;
-
new Output().withSpeechAndBraille(
this.currentRange_, prevRange, Output.EventType.NAVIGATE)
.go();
@@ -351,12 +352,10 @@
this.currentRange_ = cursors.Range.fromNode(node);
- // Check to see if we've crossed roots. Continue if we've crossed roots or
- // are not within web content.
- if (node.root.role == 'desktop' ||
- !prevRange ||
+ // Check to see if we've crossed roots. Only care about focused roots.
+ if (!prevRange ||
(prevRange.getStart().getNode().root != node.root &&
- node.state.focused))
+ node.root.focused))
this.setupChromeVoxVariants_(node.root.docUrl || '');
// Don't process nodes inside of web content if ChromeVox Next is inactive.
@@ -365,12 +364,6 @@
chrome.accessibilityPrivate.setFocusRing([]);
return;
}
-
- // Don't output if focused node hasn't changed.
- if (prevRange &&
- evt.type == 'focus' &&
- this.currentRange_.equals(prevRange))
- return;
new Output().withSpeechAndBraille(
this.currentRange_, prevRange, evt.type)
@@ -519,7 +512,7 @@
* @private
*/
isWhitelistedForCompat_: function(url) {
- return url.indexOf('chrome://md-settings') != -1 || url === '';
+ return url.indexOf('chrome://md-settings') != -1;
},
/**
@@ -539,15 +532,14 @@
* @private
*/
setupChromeVoxVariants_: function(url) {
+ this.compat_.active = this.isWhitelistedForCompat_(url);
var mode = this.mode_;
- if (mode != ChromeVoxMode.FORCE_NEXT) {
- if (this.isWhitelistedForCompat_(url))
- mode = ChromeVoxMode.COMPAT;
- else if (this.isWhitelistedForNext_(url))
- mode = ChromeVoxMode.NEXT;
- else
- mode = ChromeVoxMode.CLASSIC;
- }
+ if (this.compat_.active)
+ mode = ChromeVoxMode.COMPAT;
+ else if (this.isWhitelistedForNext_(url))
+ mode = ChromeVoxMode.NEXT;
+ else if (mode != ChromeVoxMode.FORCE_NEXT)
+ mode = ChromeVoxMode.CLASSIC;
this.setChromeVoxMode(mode);
},
@@ -585,17 +577,13 @@
// for tabs, re-enable.
// cvox.ChromeVox.injectChromeVoxIntoTabs(tabs);
} else {
- // When in compat mode, if the focus is within the desktop tree proper,
- // then do not disable content scripts.
- if (this.currentRange_.getStart().getNode().root.role == 'desktop')
- return;
-
tabs.forEach(function(tab) {
this.disableClassicChromeVox_(tab.id);
}.bind(this));
}
}.bind(this));
+ this.compat_.active = mode === ChromeVoxMode.COMPAT;
this.mode_ = mode;
}
};

Powered by Google App Engine
This is Rietveld 408576698