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="extension_code.js"> | 8 <include src="extension_code.js"> |
9 <include src="extension_commands_overlay.js"> | 9 <include src="extension_commands_overlay.js"> |
10 <include src="extension_error_overlay.js"> | 10 <include src="extension_error_overlay.js"> |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 * Perform initial setup. | 126 * Perform initial setup. |
127 */ | 127 */ |
128 initialize: function() { | 128 initialize: function() { |
129 uber.onContentFrameLoaded(); | 129 uber.onContentFrameLoaded(); |
130 cr.ui.FocusOutlineManager.forDocument(document); | 130 cr.ui.FocusOutlineManager.forDocument(document); |
131 measureCheckboxStrings(); | 131 measureCheckboxStrings(); |
132 | 132 |
133 // Set the title. | 133 // Set the title. |
134 uber.setTitle(loadTimeData.getString('extensionSettings')); | 134 uber.setTitle(loadTimeData.getString('extensionSettings')); |
135 | 135 |
| 136 var extensionList = new ExtensionList(); |
| 137 extensionList.id = 'extension-settings-list'; |
| 138 var wrapper = $('extension-list-wrapper'); |
| 139 wrapper.insertBefore(extensionList, wrapper.firstChild); |
| 140 |
136 // This will request the data to show on the page and will get a response | 141 // This will request the data to show on the page and will get a response |
137 // back in returnExtensionsData. | 142 // back in returnExtensionsData. |
138 chrome.send('extensionSettingsRequestExtensionsData'); | 143 chrome.send('extensionSettingsRequestExtensionsData'); |
139 | 144 |
140 var extensionLoader = extensions.ExtensionLoader.getInstance(); | 145 var extensionLoader = extensions.ExtensionLoader.getInstance(); |
141 | 146 |
142 $('toggle-dev-on').addEventListener('change', function(e) { | 147 $('toggle-dev-on').addEventListener('change', function(e) { |
143 this.updateDevControlsVisibility_(true); | 148 this.updateDevControlsVisibility_(true); |
144 $('extension-settings-list').updateFocusableElements(); | 149 extensionList.updateFocusableElements(); |
145 chrome.send('extensionSettingsToggleDeveloperMode', | 150 chrome.send('extensionSettingsToggleDeveloperMode', |
146 [$('toggle-dev-on').checked]); | 151 [$('toggle-dev-on').checked]); |
147 }.bind(this)); | 152 }.bind(this)); |
148 | 153 |
149 window.addEventListener('resize', function() { | 154 window.addEventListener('resize', function() { |
150 this.updateDevControlsVisibility_(false); | 155 this.updateDevControlsVisibility_(false); |
151 }.bind(this)); | 156 }.bind(this)); |
152 | 157 |
153 // Set up the three dev mode buttons (load unpacked, pack and update). | 158 // Set up the three dev mode buttons (load unpacked, pack and update). |
154 $('load-unpacked').addEventListener('click', function(e) { | 159 $('load-unpacked').addEventListener('click', function(e) { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 }.bind(this)); | 296 }.bind(this)); |
292 }, | 297 }, |
293 }; | 298 }; |
294 | 299 |
295 /** | 300 /** |
296 * Called by the dom_ui_ to re-populate the page with data representing | 301 * Called by the dom_ui_ to re-populate the page with data representing |
297 * the current state of installed extensions. | 302 * the current state of installed extensions. |
298 * @param {ExtensionDataResponse} extensionsData | 303 * @param {ExtensionDataResponse} extensionsData |
299 */ | 304 */ |
300 ExtensionSettings.returnExtensionsData = function(extensionsData) { | 305 ExtensionSettings.returnExtensionsData = function(extensionsData) { |
301 // We can get called many times in short order, thus we need to | |
302 // be careful to remove the 'finished loading' timeout. | |
303 if (this.loadingTimeout_) | |
304 window.clearTimeout(this.loadingTimeout_); | |
305 document.documentElement.classList.add('loading'); | |
306 this.loadingTimeout_ = window.setTimeout(function() { | |
307 document.documentElement.classList.remove('loading'); | |
308 }, 0); | |
309 | |
310 webuiResponded = true; | 306 webuiResponded = true; |
311 | 307 |
312 var supervised = extensionsData.profileIsSupervised; | 308 var supervised = extensionsData.profileIsSupervised; |
313 | 309 |
314 var pageDiv = $('extension-settings'); | 310 var pageDiv = $('extension-settings'); |
315 pageDiv.classList.toggle('profile-is-supervised', supervised); | 311 pageDiv.classList.toggle('profile-is-supervised', supervised); |
316 pageDiv.classList.toggle('showing-banner', supervised); | 312 pageDiv.classList.toggle('showing-banner', supervised); |
317 | 313 |
318 var devControlsCheckbox = $('toggle-dev-on'); | 314 var devControlsCheckbox = $('toggle-dev-on'); |
319 devControlsCheckbox.checked = extensionsData.developerMode; | 315 devControlsCheckbox.checked = extensionsData.developerMode; |
320 devControlsCheckbox.disabled = supervised; | 316 devControlsCheckbox.disabled = supervised; |
321 | 317 |
322 var instance = ExtensionSettings.getInstance(); | 318 var instance = ExtensionSettings.getInstance(); |
323 instance.displayPromo_ = extensionsData.promoteAppsDevTools; | 319 instance.displayPromo_ = extensionsData.promoteAppsDevTools; |
324 instance.updateDevControlsVisibility_(false); | 320 instance.updateDevControlsVisibility_(false); |
325 | 321 |
326 $('load-unpacked').disabled = extensionsData.loadUnpackedDisabled; | 322 $('load-unpacked').disabled = extensionsData.loadUnpackedDisabled; |
| 323 var extensionList = $('extension-settings-list'); |
| 324 extensionList.updateExtensionsData( |
| 325 extensionsData.incognitoAvailable, |
| 326 extensionsData.enableAppInfoDialog).then(function() { |
| 327 // We can get called many times in short order, thus we need to |
| 328 // be careful to remove the 'finished loading' timeout. |
| 329 if (this.loadingTimeout_) |
| 330 window.clearTimeout(this.loadingTimeout_); |
| 331 document.documentElement.classList.add('loading'); |
| 332 this.loadingTimeout_ = window.setTimeout(function() { |
| 333 document.documentElement.classList.remove('loading'); |
| 334 }, 0); |
327 | 335 |
328 ExtensionList.prototype.data_ = extensionsData; | 336 var hasExtensions = extensionList.getNumExtensions() != 0; |
329 ExtensionList.decorate($('extension-settings-list')); | 337 $('no-extensions').hidden = hasExtensions; |
| 338 $('extension-list-wrapper').hidden = !hasExtensions; |
| 339 }.bind(this)); |
330 }; | 340 }; |
331 | 341 |
332 /** | 342 /** |
333 * Returns the current overlay or null if one does not exist. | 343 * Returns the current overlay or null if one does not exist. |
334 * @return {Element} The overlay element. | 344 * @return {Element} The overlay element. |
335 */ | 345 */ |
336 ExtensionSettings.getCurrentOverlay = function() { | 346 ExtensionSettings.getCurrentOverlay = function() { |
337 return document.querySelector('#overlay .page.showing'); | 347 return document.querySelector('#overlay .page.showing'); |
338 }; | 348 }; |
339 | 349 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 437 |
428 // Export | 438 // Export |
429 return { | 439 return { |
430 ExtensionSettings: ExtensionSettings | 440 ExtensionSettings: ExtensionSettings |
431 }; | 441 }; |
432 }); | 442 }); |
433 | 443 |
434 window.addEventListener('load', function(e) { | 444 window.addEventListener('load', function(e) { |
435 extensions.ExtensionSettings.getInstance().initialize(); | 445 extensions.ExtensionSettings.getInstance().initialize(); |
436 }); | 446 }); |
OLD | NEW |