OLD | NEW |
---|---|
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 <include src="../../../../ui/webui/resources/js/cr/ui/focus_row.js"> | 5 <include src="../../../../ui/webui/resources/js/cr/ui/focus_row.js"> |
6 <include src="../../../../ui/webui/resources/js/cr/ui/focus_grid.js"> | 6 <include src="../../../../ui/webui/resources/js/cr/ui/focus_grid.js"> |
7 <include src="../uber/uber_utils.js"> | 7 <include src="../uber/uber_utils.js"> |
8 <include src="drag_and_drop_handler.js"> | 8 <include src="drag_and_drop_handler.js"> |
9 <include src="extension_code.js"> | 9 <include src="extension_code.js"> |
10 <include src="extension_commands_overlay.js"> | 10 <include src="extension_commands_overlay.js"> |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
189 update_: function(profileInfo) { | 189 update_: function(profileInfo) { |
190 // We only set the page to be loading if we haven't already finished an | 190 // We only set the page to be loading if we haven't already finished an |
191 // initial load, because otherwise the updates are all incremental and | 191 // initial load, because otherwise the updates are all incremental and |
192 // don't need to display the interstitial spinner. | 192 // don't need to display the interstitial spinner. |
193 if (!this.hasLoaded_) | 193 if (!this.hasLoaded_) |
194 this.setLoading_(true); | 194 this.setLoading_(true); |
195 webuiResponded = true; | 195 webuiResponded = true; |
196 | 196 |
197 /** @const */ | 197 /** @const */ |
198 var supervised = profileInfo.isSupervised; | 198 var supervised = profileInfo.isSupervised; |
199 var developerModeDisabledByPolicy = | |
200 profileInfo.isDeveloperModeDisabledByPolicy; | |
199 | 201 |
200 var pageDiv = $('extension-settings'); | 202 var pageDiv = $('extension-settings'); |
201 pageDiv.classList.toggle('profile-is-supervised', supervised); | 203 pageDiv.classList.toggle('profile-is-supervised', supervised); |
202 pageDiv.classList.toggle('showing-banner', supervised); | 204 pageDiv.classList.toggle('showing-banner', supervised); |
203 | 205 |
204 var devControlsCheckbox = $('toggle-dev-on'); | 206 var devControlsCheckbox = $('toggle-dev-on'); |
205 devControlsCheckbox.checked = profileInfo.inDeveloperMode; | 207 devControlsCheckbox.checked = profileInfo.inDeveloperMode; |
206 devControlsCheckbox.disabled = supervised; | 208 devControlsCheckbox.disabled = |
209 supervised || developerModeDisabledByPolicy; | |
210 | |
211 // This is necessary e.g. if developer mode is now disabled by policy | |
212 // but extension developer tools were visible | |
Devlin
2016/11/28 17:34:01
nitty-nit: comments should end with punctuation (i
pmarko
2016/11/29 12:40:22
Done.
| |
213 this.updateDevControlsVisibility_(true); | |
Devlin
2016/11/28 17:34:01
nit: We probably don't need to animate here - usua
pmarko
2016/11/29 12:40:22
Good point - passing false. Done.
| |
214 this.setDevToggleControlledIndicator_(developerModeDisabledByPolicy); | |
207 | 215 |
208 $('load-unpacked').disabled = !profileInfo.canLoadUnpacked; | 216 $('load-unpacked').disabled = !profileInfo.canLoadUnpacked; |
209 var extensionList = $('extension-settings-list'); | 217 var extensionList = $('extension-settings-list'); |
210 extensionList.updateExtensionsData( | 218 extensionList.updateExtensionsData( |
211 profileInfo.isIncognitoAvailable, | 219 profileInfo.isIncognitoAvailable, |
212 profileInfo.appInfoDialogEnabled).then(function() { | 220 profileInfo.appInfoDialogEnabled).then(function() { |
213 if (!this.hasLoaded_) { | 221 if (!this.hasLoaded_) { |
214 this.hasLoaded_ = true; | 222 this.hasLoaded_ = true; |
215 this.setLoading_(false); | 223 this.setLoading_(false); |
216 } | 224 } |
217 this.onExtensionCountChanged(); | 225 this.onExtensionCountChanged(); |
218 }.bind(this)); | 226 }.bind(this)); |
219 }, | 227 }, |
220 | 228 |
221 /** | 229 /** |
230 * Shows or hides the 'controlled by policy' indicator on the dev-toggle | |
231 * checkbox. | |
232 * @param {boolean} developerModeDisabledByPolicy true if the indicator | |
233 * should be showing. | |
234 * @private | |
235 */ | |
236 setDevToggleControlledIndicator_: function(developerModeDisabledByPolicy) { | |
237 var devToggleControlledIndicator = document.querySelector( | |
238 '#dev-toggle .controlled-setting-indicator'); | |
239 | |
240 if (!(devToggleControlledIndicator instanceof cr.ui.ControlledIndicator)) | |
241 cr.ui.ControlledIndicator.decorate(devToggleControlledIndicator); | |
242 | |
243 if (developerModeDisabledByPolicy) { | |
244 var controlledBy = 'policy'; | |
245 devToggleControlledIndicator.setAttribute('controlled-by', | |
Devlin
2016/11/28 17:34:01
nit: prefer wrapping so that either all arguments
pmarko
2016/11/29 12:40:22
Done.
| |
246 controlledBy); | |
247 devToggleControlledIndicator.setAttribute('text' + controlledBy, | |
248 loadTimeData.getString('controlledSettingPolicy')); | |
249 } | |
250 else { | |
Devlin
2016/11/28 17:34:01
else on same line as closing }
pmarko
2016/11/29 12:40:22
Done.
| |
251 devToggleControlledIndicator.removeAttribute('controlled-by'); | |
Devlin
2016/11/28 17:34:01
does removing the attribute fully hide the element
pmarko
2016/11/29 12:40:22
Removing it actually fully hides it due to control
Devlin
2016/11/30 19:19:50
I like option 3 - adding a comment that this hides
pmarko
2016/12/02 00:20:07
Done.
| |
252 } | |
253 }, | |
254 | |
255 /** | |
222 * Shows the loading spinner and hides elements that shouldn't be visible | 256 * Shows the loading spinner and hides elements that shouldn't be visible |
223 * while loading. | 257 * while loading. |
224 * @param {boolean} isLoading | 258 * @param {boolean} isLoading |
225 * @private | 259 * @private |
226 */ | 260 */ |
227 setLoading_: function(isLoading) { | 261 setLoading_: function(isLoading) { |
228 document.documentElement.classList.toggle('loading', isLoading); | 262 document.documentElement.classList.toggle('loading', isLoading); |
229 $('loading-spinner').hidden = !isLoading; | 263 $('loading-spinner').hidden = !isLoading; |
230 $('dev-controls').hidden = isLoading; | 264 $('dev-controls').hidden = isLoading; |
231 this.updateDevControlsVisibility_(false); | 265 this.updateDevControlsVisibility_(false); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
425 | 459 |
426 // Export | 460 // Export |
427 return { | 461 return { |
428 ExtensionSettings: ExtensionSettings | 462 ExtensionSettings: ExtensionSettings |
429 }; | 463 }; |
430 }); | 464 }); |
431 | 465 |
432 window.addEventListener('load', function(e) { | 466 window.addEventListener('load', function(e) { |
433 extensions.ExtensionSettings.getInstance().initialize(); | 467 extensions.ExtensionSettings.getInstance().initialize(); |
434 }); | 468 }); |
OLD | NEW |