Chromium Code Reviews| Index: chrome/browser/resources/options/content_settings_exceptions_area.js |
| diff --git a/chrome/browser/resources/options/content_settings_exceptions_area.js b/chrome/browser/resources/options/content_settings_exceptions_area.js |
| index 3ad7ac62a552f0e1079168e4d2c97cf12e4e61c1..05a940cb8aa559c44e6f93ed06211ed5d3d74963 100644 |
| --- a/chrome/browser/resources/options/content_settings_exceptions_area.js |
| +++ b/chrome/browser/resources/options/content_settings_exceptions_area.js |
| @@ -345,6 +345,27 @@ cr.define('options.contentSettings', function() { |
| settingOption.selected = true; |
| }, |
| + /** |
| + * Updates UI to indicate that the exception was overruled by a source. |
| + * |
| + * @param {string} overruledBy The source that overrules the exception. |
| + */ |
| + setOverruledBy: function(overruledBy) { |
| + this.classList.toggle('overruled', !!overruledBy); |
| + var textElt = this.querySelector('.exception-pattern .static-text'); |
| + textElt.setAttribute('title', |
| + loadTimeData.getString('exceptionDisabledByPolicy')); |
| + |
| + var indicator = new ControlledSettingIndicator(); |
|
Bernhard Bauer
2016/05/19 14:20:41
This duplicates a lot of code in lines 208ff. Coul
huangs
2016/05/20 15:16:46
Done; extracted to appendIndicatorElement().
Yeah
|
| + indicator.setAttribute('content-exception', this.contentType); |
| + // Create a synthetic pref change event decorated as |
| + // CoreOptionsHandler::CreateValueForPref() does. |
| + var event = new Event(this.contentType); |
| + event.value = { controlledBy: overruledBy }; |
| + indicator.handlePrefChange(event); |
| + this.appendChild(indicator); |
| + }, |
| + |
| /** @override */ |
| get currentInputIsValid() { |
| return this.inputValidityKnown && this.inputIsValid; |
| @@ -520,6 +541,20 @@ cr.define('options.contentSettings', function() { |
| }, |
| /** |
| + * Updates UI to indicate that user exceptions were overruled by a source. |
| + * |
| + * @param {string} overruledBy The source that overrules user exceptions. |
| + */ |
| + setOverruledBy: function(overruledBy) { |
| + for (var index = 0; index < this.dataModel.length; ++index) { |
| + var item = this.getListItemByIndex(index); |
| + if (item.dataItem.source == 'preference') { |
| + item.setOverruledBy(overruledBy); |
| + } |
| + } |
| + }, |
| + |
| + /** |
| * Sets the exceptions in the js model. |
| * |
| * @param {Array<options.Exception>} entries A list of dictionaries of |