Chromium Code Reviews| 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..fb7dee0afe1267f626b66d7592c6464bf87c0585 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); |
| + } |
| } |
| }; |
| @@ -168,10 +169,7 @@ cr.define('options', function() { |
| * is the filter string, and the second is the setting (allow/block). |
| */ |
| ContentSettings.setExceptions = function(type, list) { |
|
Evan Stade
2014/05/02 01:18:33
s/list/exceptions please
Dan Beam
2014/05/02 18:28:05
Done.
|
| - var exceptionsList = |
| - document.querySelector('div[contentType=' + type + ']' + |
| - ' list[mode=normal]'); |
| - exceptionsList.setExceptions(list); |
| + this.getExceptionsList(type, 'normal').setExceptions(list); |
| }; |
| ContentSettings.setHandlers = function(list) { |
| @@ -183,15 +181,22 @@ cr.define('options', function() { |
| }; |
| ContentSettings.setOTRExceptions = function(type, list) { |
|
Evan Stade
2014/05/02 01:18:33
ditto
Dan Beam
2014/05/02 18:28:05
Done.
|
| - var exceptionsList = |
| - document.querySelector('div[contentType=' + type + ']' + |
| - ' list[mode=otr]'); |
| - |
| + var exceptionsList = this.getExceptionsList(type, 'otr'); |
| exceptionsList.parentNode.hidden = false; |
| exceptionsList.setExceptions(list); |
| }; |
| /** |
| + * @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 + ']'); |
| + }; |
| + |
| + /** |
| * The browser's response to a request to check the validity of a given URL |
| * pattern. |
| * @param {string} type The content type. |
| @@ -202,10 +207,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 +219,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 +229,7 @@ cr.define('options', function() { |
| */ |
| ContentSettings.showMediaPepperFlashExceptionsLink = function(show) { |
| $('media-pepper-flash-exceptions').hidden = !show; |
| - } |
| + }; |
| /** |
| * Shows/hides the whole Web MIDI settings. |
| @@ -234,7 +237,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 +278,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. |