| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 cr.define('options', function() { | 5 cr.define('options', function() { |
| 6 | 6 |
| 7 var OptionsPage = options.OptionsPage; | 7 var OptionsPage = options.OptionsPage; |
| 8 | 8 |
| 9 ////////////////////////////////////////////////////////////////////////////// | 9 ////////////////////////////////////////////////////////////////////////////// |
| 10 // ContentSettings class: | 10 // ContentSettings class: |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 * Initializes an exceptions list. | 91 * Initializes an exceptions list. |
| 92 * @param {string} type The content type that we are setting exceptions for. | 92 * @param {string} type The content type that we are setting exceptions for. |
| 93 * @param {Array} list An array of pairs, where the first element of each pair | 93 * @param {Array} list An array of pairs, where the first element of each pair |
| 94 * is the filter string, and the second is the setting (allow/block). | 94 * is the filter string, and the second is the setting (allow/block). |
| 95 */ | 95 */ |
| 96 ContentSettings.setExceptions = function(type, list) { | 96 ContentSettings.setExceptions = function(type, list) { |
| 97 var exceptionsList = | 97 var exceptionsList = |
| 98 document.querySelector('div[contentType=' + type + ']' + | 98 document.querySelector('div[contentType=' + type + ']' + |
| 99 ' list[mode=normal]'); | 99 ' list[mode=normal]'); |
| 100 | 100 |
| 101 exceptionsList.reset(); | 101 exceptionsList.setExceptions(list); |
| 102 for (var i = 0; i < list.length; i++) { | |
| 103 exceptionsList.addException(list[i]); | |
| 104 } | |
| 105 exceptionsList.redraw(); | |
| 106 }; | 102 }; |
| 107 | 103 |
| 108 ContentSettings.setOTRExceptions = function(type, list) { | 104 ContentSettings.setOTRExceptions = function(type, list) { |
| 109 var exceptionsList = | 105 var exceptionsList = |
| 110 document.querySelector('div[contentType=' + type + ']' + | 106 document.querySelector('div[contentType=' + type + ']' + |
| 111 ' list[mode=otr]'); | 107 ' list[mode=otr]'); |
| 112 | 108 |
| 113 exceptionsList.parentNode.classList.remove('hidden'); | 109 exceptionsList.parentNode.classList.remove('hidden'); |
| 114 | 110 exceptionsList.setExceptions(list); |
| 115 exceptionsList.reset(); | |
| 116 for (var i = 0; i < list.length; i++) { | |
| 117 exceptionsList.addException(list[i]); | |
| 118 } | |
| 119 exceptionsList.redraw(); | |
| 120 }; | 111 }; |
| 121 | 112 |
| 122 /** | 113 /** |
| 123 * Sets the initial value for the Third Party Cookies checkbox. | 114 * Sets the initial value for the Third Party Cookies checkbox. |
| 124 * @param {boolean=} block True if we are blocking third party cookies. | 115 * @param {boolean=} block True if we are blocking third party cookies. |
| 125 */ | 116 */ |
| 126 ContentSettings.setBlockThirdPartyCookies = function(block) { | 117 ContentSettings.setBlockThirdPartyCookies = function(block) { |
| 127 $('block-third-party-cookies').checked = block; | 118 $('block-third-party-cookies').checked = block; |
| 128 }; | 119 }; |
| 129 | 120 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 143 'list[mode=' + mode + ']'); | 134 'list[mode=' + mode + ']'); |
| 144 exceptionsList.patternValidityCheckComplete(pattern, valid); | 135 exceptionsList.patternValidityCheckComplete(pattern, valid); |
| 145 }; | 136 }; |
| 146 | 137 |
| 147 // Export | 138 // Export |
| 148 return { | 139 return { |
| 149 ContentSettings: ContentSettings | 140 ContentSettings: ContentSettings |
| 150 }; | 141 }; |
| 151 | 142 |
| 152 }); | 143 }); |
| OLD | NEW |