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_list.js"></include> | 6 <include src="extension_list.js"></include> |
7 <include src="pack_extension_overlay.js"></include> | 7 <include src="pack_extension_overlay.js"></include> |
8 | 8 |
9 // Used for observing function of the backend datasource for this page by | 9 // Used for observing function of the backend datasource for this page by |
10 // tests. | 10 // tests. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 var packExtensionOverlay = extensions.PackExtensionOverlay.getInstance(); | 61 var packExtensionOverlay = extensions.PackExtensionOverlay.getInstance(); |
62 packExtensionOverlay.initializePage(); | 62 packExtensionOverlay.initializePage(); |
63 | 63 |
64 // Trigger the scroll handler to tell the navigation if our page started | 64 // Trigger the scroll handler to tell the navigation if our page started |
65 // with some scroll (happens when you use tab restore). | 65 // with some scroll (happens when you use tab restore). |
66 this.handleScroll_(); | 66 this.handleScroll_(); |
67 }, | 67 }, |
68 | 68 |
69 /** | 69 /** |
70 * Utility function which asks the C++ to show a platform-specific file | |
71 * select dialog, and fire |callback| with the |filePath| that resulted. | |
72 * |selectType| can be either 'file' or 'folder'. |operation| can be 'load', | |
73 * 'packRoot', or 'pem' which are signals to the C++ to do some | |
74 * operation-specific configuration. | |
75 * @private | |
76 */ | |
77 showFileDialog_: function(selectType, operation, callback) { | |
78 handleFilePathSelected = function(filePath) { | |
79 callback(filePath); | |
80 handleFilePathSelected = function() {}; | |
81 }; | |
82 | |
83 chrome.send('extensionSettingsSelectFilePath', [selectType, operation]); | |
84 }, | |
85 | |
86 /** | |
87 * Handles the Load Unpacked Extension button. | 70 * Handles the Load Unpacked Extension button. |
88 * @param {Event} e Change event. | 71 * @param {Event} e Change event. |
89 * @private | 72 * @private |
90 */ | 73 */ |
91 handleLoadUnpackedExtension_: function(e) { | 74 handleLoadUnpackedExtension_: function(e) { |
92 this.showFileDialog_('folder', 'pem', function(filePath) { | 75 chrome.send('extensionSettingsLoadUnpackedExtension'); |
93 chrome.send('extensionSettingsLoad', [String(filePath)]); | |
94 }); | |
95 | 76 |
| 77 // TODO(jhawkins): Refactor metrics support out of options and use it |
| 78 // in extensions.html. |
96 chrome.send('coreOptionsUserMetricsAction', | 79 chrome.send('coreOptionsUserMetricsAction', |
97 ['Options_LoadUnpackedExtension']); | 80 ['Options_LoadUnpackedExtension']); |
98 }, | 81 }, |
99 | 82 |
100 /** | 83 /** |
101 * Handles the Pack Extension button. | 84 * Handles the Pack Extension button. |
102 * @param {Event} e Change event. | 85 * @param {Event} e Change event. |
103 * @private | 86 * @private |
104 */ | 87 */ |
105 handlePackExtension_: function(e) { | 88 handlePackExtension_: function(e) { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 ExtensionSettings: ExtensionSettings | 231 ExtensionSettings: ExtensionSettings |
249 }; | 232 }; |
250 }); | 233 }); |
251 | 234 |
252 var ExtensionSettings = extensions.ExtensionSettings; | 235 var ExtensionSettings = extensions.ExtensionSettings; |
253 | 236 |
254 // 'load' seems to have a bad interaction with open_sans.woff. | 237 // 'load' seems to have a bad interaction with open_sans.woff. |
255 window.addEventListener('DOMContentLoaded', function(e) { | 238 window.addEventListener('DOMContentLoaded', function(e) { |
256 ExtensionSettings.getInstance().initialize(); | 239 ExtensionSettings.getInstance().initialize(); |
257 }); | 240 }); |
OLD | NEW |