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

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

Issue 8815014: Add support for recommended settings to the internet details dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 9 years 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
« no previous file with comments | « chrome/browser/resources/options/chromeos/internet_options.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 // Apply text overrides. 92 // Apply text overrides.
93 if (self.hasAttribute('text' + self.controlledBy)) 93 if (self.hasAttribute('text' + self.controlledBy))
94 text = self.getAttribute('text' + self.controlledBy); 94 text = self.getAttribute('text' + self.controlledBy);
95 95
96 // Create the DOM tree. 96 // Create the DOM tree.
97 var bubbleText = doc.createElement('p'); 97 var bubbleText = doc.createElement('p');
98 bubbleText.className = 'controlled-setting-bubble-text'; 98 bubbleText.className = 'controlled-setting-bubble-text';
99 bubbleText.textContent = text; 99 bubbleText.textContent = text;
100 100
101 var pref = self.getAttribute('pref'); 101 var allowReset = self.getAttribute('allow-reset');
102 if (self.controlledBy == 'recommended' && pref) { 102 if (self.controlledBy == 'recommended' && allowReset) {
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 localStrings.getString('controlledSettingApplyRecommendation'); 108 localStrings.getString('controlledSettingApplyRecommendation');
109 action.addEventListener( 109 action.addEventListener(
110 'click', 110 'click',
111 function(e) { 111 function(e) {
112 Preferences.clearPref(pref); 112 // Fire the reset event, falling back to just resetting the pref.
113 if (!cr.dispatchSimpleEvent(self, 'reset', true, true)) {
114 var pref = self.getAttribute('pref');
115 if (pref)
116 Preferences.clearPref(pref);
117 }
113 }); 118 });
114 container.appendChild(action); 119 container.appendChild(action);
115 bubbleText.appendChild(container); 120 bubbleText.appendChild(container);
116 } 121 }
117 122
118 bubbleContainer.appendChild(bubbleText); 123 bubbleContainer.appendChild(bubbleText);
119 124
120 // One-time bubble-closing event handler. 125 // One-time bubble-closing event handler.
121 self.closeHandler_ = this.close.bind(this); 126 self.closeHandler_ = this.close.bind(this);
122 doc.addEventListener('click', self.closeHandler_, true); 127 doc.addEventListener('click', self.closeHandler_, true);
123 } 128 }
124 }; 129 };
125 130
126 /** 131 /**
127 * The controlling entity of the setting. Can take the values "policy", 132 * The controlling entity of the setting. Can take the values "policy",
128 * "extension", "recommended" or be unset. 133 * "extension", "recommended" or be unset.
129 */ 134 */
130 cr.defineProperty(ControlledSettingIndicator, 'controlledBy', 135 cr.defineProperty(ControlledSettingIndicator, 'controlledBy',
131 cr.PropertyKind.ATTR, 136 cr.PropertyKind.ATTR,
132 ControlledSettingIndicator.prototype.close); 137 ControlledSettingIndicator.prototype.close);
133 138
134 // Export. 139 // Export.
135 return { 140 return {
136 ControlledSettingIndicator : ControlledSettingIndicator 141 ControlledSettingIndicator : ControlledSettingIndicator
137 }; 142 };
138 }); 143 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/chromeos/internet_options.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698