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