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 1b81537509a4a97a09ffc145494ffee2e8e08c67..b35eb3a9b4c3106d435c3f13735c8dcdeb73e53d 100644 |
| --- a/chrome/browser/resources/options/content_settings_exceptions_area.js |
| +++ b/chrome/browser/resources/options/content_settings_exceptions_area.js |
| @@ -3,6 +3,8 @@ |
| // found in the LICENSE file. |
| cr.define('options.contentSettings', function() { |
| + /** @const */ var ControlledSettingIndicator = |
| + options.ControlledSettingIndicator; |
| /** @const */ var InlineEditableItemList = options.InlineEditableItemList; |
| /** @const */ var InlineEditableItem = options.InlineEditableItem; |
| /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; |
| @@ -49,6 +51,13 @@ cr.define('options.contentSettings', function() { |
| this.patternLabel = patternCell.querySelector('.static-text'); |
| var input = patternCell.querySelector('input'); |
| + // If the source of the content setting exception is not a user |
| + // preference, that source controls the exception and the user cannot edit |
| + // or delete it. |
| + var controlledBy = |
| + this.dataItem.source && this.dataItem.source != 'preference' ? |
| + this.dataItem.source : null; |
|
Joao da Silva
2012/10/15 08:02:32
How about:
var controlledBy = this.dataItem.sourc
bartfab (slow)
2012/10/15 12:34:07
Move done. The change to the code you suggested wi
Joao da Silva
2012/10/15 12:53:59
|controlledBy| is always tested before begin used
|
| + |
| // TODO(stuartmorgan): Create an createEditableSelectCell abstracting |
| // this code. |
| // Setting label for display mode. |pattern| will be null for the 'add new |
| @@ -132,19 +141,27 @@ cr.define('options.contentSettings', function() { |
| this.editable = false; |
| } |
| - // If the source of the content setting exception is not the user |
| - // preference, then the content settings exception is managed and the user |
| - // can't edit it. |
| - if (this.dataItem.source && |
| - this.dataItem.source != 'preference') { |
| - this.setAttribute('managedby', this.dataItem.source); |
| + if (controlledBy) { |
| + this.setAttribute('controlled-by', controlledBy); |
| this.deletable = false; |
| this.editable = false; |
| } |
| + if (controlledBy == 'policy' || controlledBy == 'extension') { |
| + this.querySelector('.row-delete-button').hidden = true; |
| + var indicator = ControlledSettingIndicator(); |
| + indicator.setAttribute('content-exception', this.contentType); |
| + // Create a synthetic pref change event decorated as |
| + // CoreOptionsHandler::CreateValueForPref() does. |
| + var event = new cr.Event(this.contentType); |
| + event.value = { controlledBy: controlledBy }; |
| + indicator.handlePrefChange(event); |
| + this.appendChild(indicator); |
| + } |
| + |
| // If the exception comes from a hosted app, display the name and the |
| // icon of the app. |
| - if (this.dataItem.source == 'HostedApp') { |
| + if (controlledBy == 'HostedApp') { |
| this.title = |
| loadTimeData.getString('set_by') + ' ' + this.dataItem.appName; |
| var button = this.querySelector('.row-delete-button'); |