Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Unified Diff: chrome/browser/resources/options/content_settings_exceptions_area.js

Issue 11078023: Add controlled setting indicators for content settings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..1cba578050084601b72033b670d45bc2c20719bf 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;
@@ -132,19 +134,34 @@ 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 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;
+
+ 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');
« no previous file with comments | « chrome/browser/resources/options/content_settings.js ('k') | chrome/browser/resources/options/controlled_setting.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698