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..9bcbc5138137e7ae9eca235ea68d084ab407f49f 100644 |
--- a/chrome/browser/resources/options/content_settings_exceptions_area.js |
+++ b/chrome/browser/resources/options/content_settings_exceptions_area.js |
@@ -91,7 +91,7 @@ cr.define('options.contentSettings', function() { |
if (this.pattern) { |
var settingLabel = cr.doc.createElement('span'); |
settingLabel.textContent = this.settingForDisplay(); |
- settingLabel.className = 'exception-setting'; |
+ settingLabel.className = 'exception-setting overruleable'; |
settingLabel.setAttribute('displaymode', 'static'); |
this.contentElement.appendChild(settingLabel); |
this.settingLabel = settingLabel; |
@@ -205,14 +205,7 @@ cr.define('options.contentSettings', function() { |
if (controlledBy == 'policy' || controlledBy == 'extension') { |
this.querySelector('.row-delete-button').hidden = true; |
- var indicator = new ControlledSettingIndicator(); |
- 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: controlledBy }; |
- indicator.handlePrefChange(event); |
- this.appendChild(indicator); |
+ this.appendIndicatorElement(controlledBy); |
} |
// If the exception comes from a hosted app, display the name and the |
@@ -241,6 +234,22 @@ cr.define('options.contentSettings', function() { |
this.addEventListener('commitedit', this.onEditCommitted_); |
}, |
+ /** |
+ * Appends an indicator element to the item. Should be called at most once. |
+ * |
+ * @param {string} controlledBy The source that controls the item. |
+ */ |
+ appendIndicatorElement: function(controlledBy) { |
+ var indicator = new ControlledSettingIndicator(); |
+ 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: controlledBy}; |
+ indicator.handlePrefChange(event); |
+ this.appendChild(indicator); |
+ }, |
+ |
isEmbeddingRule: function() { |
return this.dataItem.embeddingOrigin && |
this.dataItem.embeddingOrigin !== this.dataItem.origin; |
@@ -345,6 +354,16 @@ 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); |
+ this.appendIndicatorElement(overruledBy); |
+ }, |
+ |
/** @override */ |
get currentInputIsValid() { |
return this.inputValidityKnown && this.inputIsValid; |
@@ -520,6 +539,19 @@ 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 |