| 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="../uber/uber_utils.js"></include> | 5 <include src="../uber/uber_utils.js"></include> |
| 6 |
| 7 // Include this before extensions modules. |
| 8 <include src="extension_util.js"></include> |
| 9 |
| 6 <include src="extension_commands_overlay.js"></include> | 10 <include src="extension_commands_overlay.js"></include> |
| 7 <include src="extension_focus_manager.js"></include> | 11 <include src="extension_focus_manager.js"></include> |
| 8 <include src="extension_list.js"></include> | 12 <include src="extension_list.js"></include> |
| 9 <include src="pack_extension_overlay.js"></include> | 13 <include src="pack_extension_overlay.js"></include> |
| 10 <include src="extension_error_overlay.js"></include> | 14 <include src="extension_error_overlay.js"></include> |
| 15 <include src="extension_loader.js"></include> |
| 11 | 16 |
| 12 <if expr="chromeos"> | 17 <if expr="chromeos"> |
| 13 <include src="chromeos/kiosk_apps.js"></include> | 18 <include src="chromeos/kiosk_apps.js"></include> |
| 14 </if> | 19 </if> |
| 15 | 20 |
| 16 // Used for observing function of the backend datasource for this page by | 21 // Used for observing function of the backend datasource for this page by |
| 17 // tests. | 22 // tests. |
| 18 var webuiResponded = false; | 23 var webuiResponded = false; |
| 19 | 24 |
| 20 cr.define('extensions', function() { | 25 cr.define('extensions', function() { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 measureCheckboxStrings(); | 99 measureCheckboxStrings(); |
| 95 | 100 |
| 96 // Set the title. | 101 // Set the title. |
| 97 var title = loadTimeData.getString('extensionSettings'); | 102 var title = loadTimeData.getString('extensionSettings'); |
| 98 uber.invokeMethodOnParent('setTitle', {title: title}); | 103 uber.invokeMethodOnParent('setTitle', {title: title}); |
| 99 | 104 |
| 100 // This will request the data to show on the page and will get a response | 105 // This will request the data to show on the page and will get a response |
| 101 // back in returnExtensionsData. | 106 // back in returnExtensionsData. |
| 102 chrome.send('extensionSettingsRequestExtensionsData'); | 107 chrome.send('extensionSettingsRequestExtensionsData'); |
| 103 | 108 |
| 109 var extensionLoader = extensions.ExtensionLoader.getInstance(); |
| 110 |
| 104 $('toggle-dev-on').addEventListener('change', | 111 $('toggle-dev-on').addEventListener('change', |
| 105 this.handleToggleDevMode_.bind(this)); | 112 this.handleToggleDevMode_.bind(this)); |
| 106 $('dev-controls').addEventListener('webkitTransitionEnd', | 113 $('dev-controls').addEventListener('webkitTransitionEnd', |
| 107 this.handleDevControlsTransitionEnd_.bind(this)); | 114 this.handleDevControlsTransitionEnd_.bind(this)); |
| 108 | 115 |
| 109 // Set up the three dev mode buttons (load unpacked, pack and update). | 116 // Set up the three dev mode buttons (load unpacked, pack and update). |
| 110 $('load-unpacked').addEventListener('click', | 117 $('load-unpacked').addEventListener('click', function(e) { |
| 111 this.handleLoadUnpackedExtension_.bind(this)); | 118 extensionLoader.loadUnpacked(); |
| 119 }); |
| 112 $('pack-extension').addEventListener('click', | 120 $('pack-extension').addEventListener('click', |
| 113 this.handlePackExtension_.bind(this)); | 121 this.handlePackExtension_.bind(this)); |
| 114 $('update-extensions-now').addEventListener('click', | 122 $('update-extensions-now').addEventListener('click', |
| 115 this.handleUpdateExtensionNow_.bind(this)); | 123 this.handleUpdateExtensionNow_.bind(this)); |
| 116 | 124 |
| 117 // Set up the close dialog for the apps developer tools promo. | 125 // Set up the close dialog for the apps developer tools promo. |
| 118 $('apps-developer-tools-promo').querySelector('.close-button'). | 126 $('apps-developer-tools-promo').querySelector('.close-button'). |
| 119 addEventListener('click', function(e) { | 127 addEventListener('click', function(e) { |
| 120 $('extension-settings').classList.remove('adt-promo'); | 128 $('extension-settings').classList.remove('adt-promo'); |
| 121 chrome.send('extensionSettingsDismissADTPromo'); | 129 chrome.send('extensionSettingsDismissADTPromo'); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // Skip starting slash and remove trailing slash (if any). | 170 // Skip starting slash and remove trailing slash (if any). |
| 163 var overlayName = path.slice(1).replace(/\/$/, ''); | 171 var overlayName = path.slice(1).replace(/\/$/, ''); |
| 164 if (overlayName == 'configureCommands') | 172 if (overlayName == 'configureCommands') |
| 165 this.showExtensionCommandsConfigUi_(); | 173 this.showExtensionCommandsConfigUi_(); |
| 166 } | 174 } |
| 167 | 175 |
| 168 preventDefaultOnPoundLinkClicks(); // From webui/js/util.js. | 176 preventDefaultOnPoundLinkClicks(); // From webui/js/util.js. |
| 169 }, | 177 }, |
| 170 | 178 |
| 171 /** | 179 /** |
| 172 * Handles the Load Unpacked Extension button. | |
| 173 * @param {Event} e Change event. | |
| 174 * @private | |
| 175 */ | |
| 176 handleLoadUnpackedExtension_: function(e) { | |
| 177 chrome.send('extensionSettingsLoadUnpackedExtension'); | |
| 178 }, | |
| 179 | |
| 180 /** | |
| 181 * Handles the Pack Extension button. | 180 * Handles the Pack Extension button. |
| 182 * @param {Event} e Change event. | 181 * @param {Event} e Change event. |
| 183 * @private | 182 * @private |
| 184 */ | 183 */ |
| 185 handlePackExtension_: function(e) { | 184 handlePackExtension_: function(e) { |
| 186 ExtensionSettings.showOverlay($('pack-extension-overlay')); | 185 ExtensionSettings.showOverlay($('pack-extension-overlay')); |
| 187 chrome.send('metricsHandler:recordAction', ['Options_PackExtension']); | 186 chrome.send('metricsHandler:recordAction', ['Options_PackExtension']); |
| 188 }, | 187 }, |
| 189 | 188 |
| 190 /** | 189 /** |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 | 407 |
| 409 // Export | 408 // Export |
| 410 return { | 409 return { |
| 411 ExtensionSettings: ExtensionSettings | 410 ExtensionSettings: ExtensionSettings |
| 412 }; | 411 }; |
| 413 }); | 412 }); |
| 414 | 413 |
| 415 window.addEventListener('load', function(e) { | 414 window.addEventListener('load', function(e) { |
| 416 extensions.ExtensionSettings.getInstance().initialize(); | 415 extensions.ExtensionSettings.getInstance().initialize(); |
| 417 }); | 416 }); |
| OLD | NEW |