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

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

Issue 1513933005: Reland: Make the check for compat mode explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 34e73ebaae3e70127f591aa7cc7935010f9b6369..ad87568070dd62b244b03c97f317ae30acae5516 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
@@ -169,8 +169,7 @@ Background.prototype = {
} else {
// When in compat mode, if the focus is within the desktop tree proper,
// then do not disable content scripts.
- if (this.currentRange_ &&
- this.currentRange_.start.node.root.role == RoleType.desktop)
+ if (this.currentRange_ && !this.currentRange_.isWebRange())
return;
this.disableClassicChromeVox_();
@@ -189,17 +188,24 @@ Background.prototype = {
},
/**
+ * Mode refreshes takes into account both |url| and the current ChromeVox
+ * range. The latter gets used to decide if the user is or isn't in web
+ * content. The focused state also needs to be set for this info to be
+ * reliable.
* @override
*/
refreshMode: function(url) {
var mode = this.mode_;
if (mode != ChromeVoxMode.FORCE_NEXT) {
- if (this.isWhitelistedForNext_(url))
+ if (this.isWhitelistedForNext_(url)) {
mode = ChromeVoxMode.NEXT;
- else if (this.isBlacklistedForClassic_(url))
+ } else if (this.isBlacklistedForClassic_(url) || (this.currentRange_ &&
+ !this.currentRange_.isWebRange() &&
+ this.currentRange_.start.node.state.focused)) {
mode = ChromeVoxMode.COMPAT;
- else
+ } else {
mode = ChromeVoxMode.CLASSIC;
+ }
}
this.setMode(mode);
@@ -440,9 +446,8 @@ Background.prototype = {
case 'toggleChromeVoxVersion':
var newMode;
if (this.mode_ == ChromeVoxMode.FORCE_NEXT) {
- var inViews =
- this.currentRange_.start.node.root.role == RoleType.desktop;
- newMode = inViews ? ChromeVoxMode.COMPAT : ChromeVoxMode.CLASSIC;
+ var inWeb = current.isWebRange();
+ newMode = inWeb ? ChromeVoxMode.CLASSIC : ChromeVoxMode.COMPAT;
} else {
newMode = ChromeVoxMode.FORCE_NEXT;
}
@@ -573,7 +578,7 @@ Background.prototype = {
* @private
*/
isBlacklistedForClassic_: function(url) {
- return url === '' || this.classicBlacklistRegExp_.test(url);
+ return this.classicBlacklistRegExp_.test(url);
},
/**

Powered by Google App Engine
This is Rietveld 408576698