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

Side by Side Diff: chrome/browser/resources/options/controlled_setting.js

Issue 10827141: Move handling of dialog preferences to Preferences class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed PrefCheckbox. Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 cr.define('options', function() { 5 cr.define('options', function() {
6 var Preferences = options.Preferences; 6 var Preferences = options.Preferences;
7 7
8 /** 8 /**
9 * A controlled setting indicator that can be placed on a setting as an 9 * A controlled setting indicator that can be placed on a setting as an
10 * indicator that the value is controlled by some external entity such as 10 * indicator that the value is controlled by some external entity such as
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 if (self.controlledBy == 'recommended' && pref) { 102 if (self.controlledBy == 'recommended' && pref) {
103 var container = doc.createElement('div'); 103 var container = doc.createElement('div');
104 var action = doc.createElement('button'); 104 var action = doc.createElement('button');
105 action.classList.add('link-button'); 105 action.classList.add('link-button');
106 action.classList.add('controlled-setting-bubble-action'); 106 action.classList.add('controlled-setting-bubble-action');
107 action.textContent = 107 action.textContent =
108 loadTimeData.getString('controlledSettingApplyRecommendation'); 108 loadTimeData.getString('controlledSettingApplyRecommendation');
109 action.addEventListener( 109 action.addEventListener(
110 'click', 110 'click',
111 function(e) { 111 function(e) {
112 Preferences.clearPref(pref); 112 Preferences.clearPref(pref, self.dialogPref);
113 }); 113 });
114 container.appendChild(action); 114 container.appendChild(action);
115 bubbleText.appendChild(container); 115 bubbleText.appendChild(container);
116 } 116 }
117 117
118 bubbleContainer.appendChild(bubbleText); 118 bubbleContainer.appendChild(bubbleText);
119 119
120 // One-time bubble-closing event handler. 120 // One-time bubble-closing event handler.
121 self.closeHandler_ = this.close.bind(this); 121 self.closeHandler_ = this.close.bind(this);
122 doc.addEventListener('click', self.closeHandler_, true); 122 doc.addEventListener('click', self.closeHandler_, true);
123 } 123 }
124 }; 124 };
125 125
126 /** 126 /**
127 * The controlling entity of the setting. Can take the values "policy", 127 * The controlling entity of the setting. Can take the values "policy",
128 * "extension", "recommended" or be unset. 128 * "extension", "recommended" or be unset.
129 */ 129 */
130 cr.defineProperty(ControlledSettingIndicator, 'controlledBy', 130 cr.defineProperty(ControlledSettingIndicator, 'controlledBy',
131 cr.PropertyKind.ATTR, 131 cr.PropertyKind.ATTR,
132 ControlledSettingIndicator.prototype.close); 132 ControlledSettingIndicator.prototype.close);
133 133
134 /**
135 * A special preference type specific to dialogs. Changes take effect in the
136 * settings UI immediately but are only actually committed when the user
137 * confirms the dialog. If the user cancels the dialog instead, the changes
138 * are rolled back in the settings UI and never committed.
139 * @type {boolean}
140 */
141 cr.defineProperty(ControlledSettingIndicator, 'dialogPref',
142 cr.PropertyKind.BOOL_ATTR);
143
134 // Export. 144 // Export.
135 return { 145 return {
136 ControlledSettingIndicator: ControlledSettingIndicator 146 ControlledSettingIndicator: ControlledSettingIndicator
137 }; 147 };
138 }); 148 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/chromeos/proxy_rules_list.js ('k') | chrome/browser/resources/options/font_settings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698