| 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 // Used for observing function of the backend datasource for this page by | 5 // Used for observing function of the backend datasource for this page by |
| 6 // tests. | 6 // tests. |
| 7 var webui_responded_ = false; | 7 var webui_responded_ = false; |
| 8 | 8 |
| 9 cr.define('options', function() { | 9 cr.define('options', function() { |
| 10 var OptionsPage = options.OptionsPage; | 10 var OptionsPage = options.OptionsPage; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // Set up the three dev mode buttons (load unpacked, pack and update). | 50 // Set up the three dev mode buttons (load unpacked, pack and update). |
| 51 $('load-unpacked').addEventListener('click', | 51 $('load-unpacked').addEventListener('click', |
| 52 this.handleLoadUnpackedExtension_.bind(this)); | 52 this.handleLoadUnpackedExtension_.bind(this)); |
| 53 $('pack-extension').addEventListener('click', | 53 $('pack-extension').addEventListener('click', |
| 54 this.handlePackExtension_.bind(this)); | 54 this.handlePackExtension_.bind(this)); |
| 55 $('update-extensions-now').addEventListener('click', | 55 $('update-extensions-now').addEventListener('click', |
| 56 this.handleUpdateExtensionNow_.bind(this)); | 56 this.handleUpdateExtensionNow_.bind(this)); |
| 57 }, | 57 }, |
| 58 | 58 |
| 59 /** | 59 /** |
| 60 * Utility function which asks the C++ to show a platform-specific file | |
| 61 * select dialog, and fire |callback| with the |filePath| that resulted. | |
| 62 * |selectType| can be either 'file' or 'folder'. |operation| can be 'load', | |
| 63 * 'packRoot', or 'pem' which are signals to the C++ to do some | |
| 64 * operation-specific configuration. | |
| 65 * @private | |
| 66 */ | |
| 67 showFileDialog_: function(selectType, operation, callback) { | |
| 68 handleFilePathSelected = function(filePath) { | |
| 69 callback(filePath); | |
| 70 handleFilePathSelected = function() {}; | |
| 71 }; | |
| 72 | |
| 73 chrome.send('extensionSettingsSelectFilePath', [selectType, operation]); | |
| 74 }, | |
| 75 | |
| 76 /** | |
| 77 * Handles the Load Unpacked Extension button. | 60 * Handles the Load Unpacked Extension button. |
| 78 * @param {Event} e Change event. | 61 * @param {Event} e Change event. |
| 79 * @private | 62 * @private |
| 80 */ | 63 */ |
| 81 handleLoadUnpackedExtension_: function(e) { | 64 handleLoadUnpackedExtension_: function(e) { |
| 82 this.showFileDialog_('folder', 'load', function(filePath) { | 65 chrome.send('extensionSettingsLoadUnpackedExtension'); |
| 83 chrome.send('extensionSettingsLoad', [String(filePath)]); | |
| 84 }); | |
| 85 | |
| 86 chrome.send('coreOptionsUserMetricsAction', | 66 chrome.send('coreOptionsUserMetricsAction', |
| 87 ['Options_LoadUnpackedExtension']); | 67 ['Options_LoadUnpackedExtension']); |
| 88 }, | 68 }, |
| 89 | 69 |
| 90 /** | 70 /** |
| 91 * Handles the Pack Extension button. | 71 * Handles the Pack Extension button. |
| 92 * @param {Event} e Change event. | 72 * @param {Event} e Change event. |
| 93 * @private | 73 * @private |
| 94 */ | 74 */ |
| 95 handlePackExtension_: function(e) { | 75 handlePackExtension_: function(e) { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 function() { | 174 function() { |
| 195 OptionsPage.closeOverlay(); | 175 OptionsPage.closeOverlay(); |
| 196 }); | 176 }); |
| 197 } | 177 } |
| 198 | 178 |
| 199 // Export | 179 // Export |
| 200 return { | 180 return { |
| 201 ExtensionSettings: ExtensionSettings | 181 ExtensionSettings: ExtensionSettings |
| 202 }; | 182 }; |
| 203 }); | 183 }); |
| OLD | NEW |