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