OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 if (!loadTimeData.getBoolean('newContentSettings')) { | 5 if (!loadTimeData.getBoolean('newContentSettings')) { |
6 | 6 |
7 cr.define('options', function() { | 7 cr.define('options', function() { |
8 /** @const */ var OptionsPage = options.OptionsPage; | 8 /** @const */ var OptionsPage = options.OptionsPage; |
9 | 9 |
10 ////////////////////////////////////////////////////////////////////////////// | 10 ////////////////////////////////////////////////////////////////////////////// |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 document.querySelector(selector).checked = true; | 93 document.querySelector(selector).checked = true; |
94 }; | 94 }; |
95 | 95 |
96 /** | 96 /** |
97 * Sets the values for all the content settings radios. | 97 * Sets the values for all the content settings radios. |
98 * @param {Object} dict A mapping from radio groups to the checked value for | 98 * @param {Object} dict A mapping from radio groups to the checked value for |
99 * that group. | 99 * that group. |
100 */ | 100 */ |
101 ContentSettings.setContentFilterSettingsValue = function(dict) { | 101 ContentSettings.setContentFilterSettingsValue = function(dict) { |
102 for (var group in dict) { | 102 for (var group in dict) { |
| 103 var managedBy = dict[group].managedBy; |
| 104 var controlledBy = managedBy == 'policy' || managedBy == 'extension' ? |
| 105 managedBy : null; |
103 document.querySelector('input[type=radio][name=' + group + '][value=' + | 106 document.querySelector('input[type=radio][name=' + group + '][value=' + |
104 dict[group].value + ']').checked = true; | 107 dict[group].value + ']').checked = true; |
105 var radios = document.querySelectorAll('input[type=radio][name=' + | 108 var radios = document.querySelectorAll('input[type=radio][name=' + |
106 group + ']'); | 109 group + ']'); |
107 var managedBy = dict[group]['managedBy']; | |
108 for (var i = 0, len = radios.length; i < len; i++) { | 110 for (var i = 0, len = radios.length; i < len; i++) { |
109 radios[i].disabled = (managedBy != 'default'); | 111 radios[i].disabled = (managedBy != 'default'); |
110 radios[i].controlledBy = managedBy; | 112 radios[i].controlledBy = controlledBy; |
111 } | 113 } |
| 114 var indicators = document.querySelectorAll( |
| 115 'span.controlled-setting-indicator[content-setting=' + group + ']'); |
| 116 if (indicators.length == 0) |
| 117 continue; |
| 118 // Create a synthetic pref change event decorated as |
| 119 // CoreOptionsHandler::CreateValueForPref() does. |
| 120 var event = new cr.Event(group); |
| 121 event.value = { |
| 122 value: dict[group].value, |
| 123 controlledBy: controlledBy, |
| 124 }; |
| 125 for (var i = 0; i < indicators.length; i++) |
| 126 indicators[i].handlePrefChange(event); |
112 } | 127 } |
113 OptionsPage.updateManagedBannerVisibility(); | 128 OptionsPage.updateManagedBannerVisibility(); |
114 }; | 129 }; |
115 | 130 |
116 /** | 131 /** |
117 * Initializes an exceptions list. | 132 * Initializes an exceptions list. |
118 * @param {string} type The content type that we are setting exceptions for. | 133 * @param {string} type The content type that we are setting exceptions for. |
119 * @param {Array} list An array of pairs, where the first element of each pair | 134 * @param {Array} list An array of pairs, where the first element of each pair |
120 * is the filter string, and the second is the setting (allow/block). | 135 * is the filter string, and the second is the setting (allow/block). |
121 */ | 136 */ |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 } | 186 } |
172 | 187 |
173 // Export | 188 // Export |
174 return { | 189 return { |
175 ContentSettings: ContentSettings | 190 ContentSettings: ContentSettings |
176 }; | 191 }; |
177 | 192 |
178 }); | 193 }); |
179 | 194 |
180 } | 195 } |
OLD | NEW |