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