OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * 'category-default-setting' is the polymer element for showing a certain | 7 * 'category-default-setting' is the polymer element for showing a certain |
8 * category under Site Settings. | 8 * category under Site Settings. |
9 */ | 9 */ |
10 Polymer({ | 10 Polymer({ |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 this.subControlParams_ = /** @type {chrome.settingsPrivate.PrefObject} */ ( | 187 this.subControlParams_ = /** @type {chrome.settingsPrivate.PrefObject} */ ( |
188 Object.assign({'value': subPrefValue}, basePref)); | 188 Object.assign({'value': subPrefValue}, basePref)); |
189 }, | 189 }, |
190 | 190 |
191 /** | 191 /** |
192 * Handles changes to the category pref and the |category| member variable. | 192 * Handles changes to the category pref and the |category| member variable. |
193 * @private | 193 * @private |
194 */ | 194 */ |
195 onCategoryChanged_: function() { | 195 onCategoryChanged_: function() { |
196 this.browserProxy.getDefaultValueForContentType(this.category) | 196 this.browserProxy.getDefaultValueForContentType(this.category) |
197 .then(function(defaultValue) { | 197 .then(defaultValue => { |
198 this.updateControlParams_(defaultValue); | 198 this.updateControlParams_(defaultValue); |
199 | 199 |
200 // Flash only shows ALLOW or BLOCK descriptions on the toggle. | 200 // Flash only shows ALLOW or BLOCK descriptions on the toggle. |
201 var setting = defaultValue.setting; | 201 var setting = defaultValue.setting; |
202 if (this.category == settings.ContentSettingsTypes.PLUGINS && | 202 if (this.category == settings.ContentSettingsTypes.PLUGINS && |
203 setting == settings.ContentSetting.IMPORTANT_CONTENT) { | 203 setting == settings.ContentSetting.IMPORTANT_CONTENT) { |
204 setting = settings.ContentSetting.ALLOW; | 204 setting = settings.ContentSetting.ALLOW; |
205 } else if ( | 205 } else if ( |
206 this.category == settings.ContentSettingsTypes.COOKIES && | 206 this.category == settings.ContentSettingsTypes.COOKIES && |
207 setting == settings.ContentSetting.SESSION_ONLY) { | 207 setting == settings.ContentSetting.SESSION_ONLY) { |
208 setting = settings.ContentSetting.ALLOW; | 208 setting = settings.ContentSetting.ALLOW; |
209 } | 209 } |
210 var categoryEnabled = setting != settings.ContentSetting.BLOCK; | 210 var categoryEnabled = setting != settings.ContentSetting.BLOCK; |
211 this.optionLabel_ = | 211 this.optionLabel_ = |
212 categoryEnabled ? this.toggleOnLabel : this.toggleOffLabel; | 212 categoryEnabled ? this.toggleOnLabel : this.toggleOffLabel; |
213 }.bind(this)); | 213 }); |
214 }, | 214 }, |
215 | 215 |
216 /** | 216 /** |
217 * @return {boolean} | 217 * @return {boolean} |
218 * @private | 218 * @private |
219 */ | 219 */ |
220 isToggleDisabled_: function() { | 220 isToggleDisabled_: function() { |
221 return this.category == settings.ContentSettingsTypes.POPUPS && | 221 return this.category == settings.ContentSettingsTypes.POPUPS && |
222 loadTimeData.getBoolean('isGuest'); | 222 loadTimeData.getBoolean('isGuest'); |
223 }, | 223 }, |
224 }); | 224 }); |
OLD | NEW |