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

Unified Diff: chrome/browser/resources/options/content_settings.js

Issue 264713008: options: fix content settings exceptions dialog regression. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: estade@ review Created 6 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/resources/options/handler_options.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/content_settings.js
diff --git a/chrome/browser/resources/options/content_settings.js b/chrome/browser/resources/options/content_settings.js
index 12b85af9be7863f713757695428aa4007df8644e..357b9eb86175f106adf455c47828b8a26747f37f 100644
--- a/chrome/browser/resources/options/content_settings.js
+++ b/chrome/browser/resources/options/content_settings.js
@@ -115,8 +115,9 @@ cr.define('options', function() {
value: dict[group].value,
controlledBy: controlledBy,
};
- for (var i = 0; i < indicators.length; i++)
+ for (var i = 0; i < indicators.length; i++) {
indicators[i].handlePrefChange(event);
+ }
}
};
@@ -164,31 +165,36 @@ cr.define('options', function() {
/**
* Initializes an exceptions list.
* @param {string} type The content type that we are setting exceptions for.
- * @param {Array} list An array of pairs, where the first element of each pair
- * is the filter string, and the second is the setting (allow/block).
+ * @param {Array} exceptions An array of pairs, where the first element of
+ * each pair is the filter string, and the second is the setting
+ * (allow/block).
*/
- ContentSettings.setExceptions = function(type, list) {
- var exceptionsList =
- document.querySelector('div[contentType=' + type + ']' +
- ' list[mode=normal]');
- exceptionsList.setExceptions(list);
+ ContentSettings.setExceptions = function(type, exceptions) {
+ this.getExceptionsList(type, 'normal').setExceptions(exceptions);
};
- ContentSettings.setHandlers = function(list) {
- $('handlers-list').setHandlers(list);
+ ContentSettings.setHandlers = function(handlers) {
+ $('handlers-list').setHandlers(handlers);
};
- ContentSettings.setIgnoredHandlers = function(list) {
- $('ignored-handlers-list').setHandlers(list);
+ ContentSettings.setIgnoredHandlers = function(ignoredHandlers) {
+ $('ignored-handlers-list').setHandlers(ignoredHandlers);
};
- ContentSettings.setOTRExceptions = function(type, list) {
- var exceptionsList =
- document.querySelector('div[contentType=' + type + ']' +
- ' list[mode=otr]');
-
+ ContentSettings.setOTRExceptions = function(type, otrExceptions) {
+ var exceptionsList = this.getExceptionsList(type, 'otr');
exceptionsList.parentNode.hidden = false;
- exceptionsList.setExceptions(list);
+ exceptionsList.setExceptions(otrExceptions);
+ };
+
+ /**
+ * @param {string} type The type of exceptions (e.g. "location") to get.
+ * @param {string} mode The mode of the desired exceptions list (e.g. otr).
+ * @return {?ExceptionsList} The corresponding exceptions list or null.
+ */
+ ContentSettings.getExceptionsList = function(type, mode) {
+ return document.querySelector(
+ 'div[contentType=' + type + '] list[mode=' + mode + ']');
};
/**
@@ -202,10 +208,8 @@ cr.define('options', function() {
*/
ContentSettings.patternValidityCheckComplete =
function(type, mode, pattern, valid) {
- var exceptionsList =
- document.querySelector('div[contentType=' + type + '] ' +
- 'list[mode=' + mode + ']');
- exceptionsList.patternValidityCheckComplete(pattern, valid);
+ this.getExceptionsList(type, mode).patternValidityCheckComplete(pattern,
+ valid);
};
/**
@@ -216,7 +220,7 @@ cr.define('options', function() {
*/
ContentSettings.showMediaPepperFlashDefaultLink = function(show) {
$('media-pepper-flash-default').hidden = !show;
- }
+ };
/**
* Shows/hides the link to the Pepper Flash camera and microphone
@@ -226,7 +230,7 @@ cr.define('options', function() {
*/
ContentSettings.showMediaPepperFlashExceptionsLink = function(show) {
$('media-pepper-flash-exceptions').hidden = !show;
- }
+ };
/**
* Shows/hides the whole Web MIDI settings.
@@ -234,7 +238,7 @@ cr.define('options', function() {
*/
ContentSettings.showExperimentalWebMIDISettings = function(show) {
$('experimental-web-midi-settings').hidden = !show;
- }
+ };
/**
* Updates the microphone/camera devices menu with the given entries.
@@ -275,10 +279,9 @@ cr.define('options', function() {
*/
ContentSettings.enableProtectedContentExceptions = function(enable) {
var exceptionsButton = $('protected-content-exceptions');
- if (exceptionsButton) {
+ if (exceptionsButton)
exceptionsButton.disabled = !enable;
- }
- }
+ };
/**
* Set the default microphone device based on the popup selection.
« no previous file with comments | « no previous file | chrome/browser/resources/options/handler_options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698