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

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

Issue 2074513002: Parse meta tag that disables ChromeVox content script and forces compat mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 5c5b4dfcd0a3c978021d6a122f9aa5eaa68e0f03..e3fab5d3202c9ed6a52cf17b1e2338eebc17d797 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
@@ -51,6 +51,14 @@ Background = function() {
this.whitelist_ = ['chromevox_next_test'];
/**
+ * A list of site substring patterns to blacklist ChromeVox Classic,
+ * putting ChromeVox into Compat mode.
+ * @type {!Array<string>}
+ * @private
+ */
+ this.classicBlacklist_ = [];
+
+ /**
* Regular expression for blacklisting classic.
* @type {RegExp}
* @private
@@ -1002,7 +1010,11 @@ Background.prototype = {
* @private
*/
isBlacklistedForClassic_: function(url) {
- return this.classicBlacklistRegExp_.test(url);
+ if (this.classicBlacklistRegExp_.test(url))
+ return true;
+ return this.classicBlacklist_.some(function(item) {
+ return url.indexOf(item) != -1;
+ });
},
/**
@@ -1075,6 +1087,11 @@ Background.prototype = {
target: 'next',
isClassicEnabled: isClassicEnabled
});
+ } else if (action == 'enableCompatForUrl') {
+ var url = msg['url'];
+ this.classicBlacklist_.push(url);
David Tseng 2016/06/15 22:50:17 Should be a dictionary/set since we don't want dup
dmazzoni 2016/06/16 20:00:06 Done.
+ if (this.currentRange_ && this.currentRange_.start.node)
+ this.refreshMode(this.currentRange_.start.node);
} else if (action == 'onCommand') {
this.onGotCommand(msg['command']);
} else if (action == 'flushNextUtterance') {

Powered by Google App Engine
This is Rietveld 408576698