| 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 cr.define('extensions', function() { | 5 cr.define('extensions', function() { |
| 6 /** | 6 /** |
| 7 * PackExtensionOverlay class | 7 * PackExtensionOverlay class |
| 8 * Encapsulated handling of the 'Pack Extension' overlay page. | 8 * Encapsulated handling of the 'Pack Extension' overlay page. |
| 9 * @constructor | 9 * @constructor |
| 10 */ | 10 */ |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 * Handles a click on the pack button. | 44 * Handles a click on the pack button. |
| 45 * @param {Event} e The click event. | 45 * @param {Event} e The click event. |
| 46 */ | 46 */ |
| 47 handleCommit_: function(e) { | 47 handleCommit_: function(e) { |
| 48 var extensionPath = $('extensionRootDir').value; | 48 var extensionPath = $('extensionRootDir').value; |
| 49 var privateKeyPath = $('extensionPrivateKey').value; | 49 var privateKeyPath = $('extensionPrivateKey').value; |
| 50 chrome.send('pack', [extensionPath, privateKeyPath, 0]); | 50 chrome.send('pack', [extensionPath, privateKeyPath, 0]); |
| 51 }, | 51 }, |
| 52 | 52 |
| 53 /** | 53 /** |
| 54 * Utility function which asks the C++ to show a platform-specific file | 54 * Utility function which asks the C++ to show a platform-specific file |
| 55 * select dialog, and fire |callback| with the |filePath| that resulted. | 55 * select dialog, and fire |callback| with the |filePath| that resulted. |
| 56 * |selectType| can be either 'file' or 'folder'. |operation| can be 'load', | 56 * |selectType| can be either 'file' or 'folder'. |operation| can be 'load' |
| 57 * 'packRoot', or 'pem' which are signals to the C++ to do some | 57 * or 'pem' which are signals to the C++ to do some operation-specific |
| 58 * operation-specific configuration. | 58 * configuration. |
| 59 * @private | 59 * @private |
| 60 */ | 60 */ |
| 61 showFileDialog_: function(selectType, operation, callback) { | 61 showFileDialog_: function(selectType, operation, callback) { |
| 62 handleFilePathSelected = function(filePath) { | 62 handleFilePathSelected = function(filePath) { |
| 63 callback(filePath); | 63 callback(filePath); |
| 64 handleFilePathSelected = function() {}; | 64 handleFilePathSelected = function() {}; |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 chrome.send('extensionSettingsSelectFilePath', [selectType, operation]); | 67 chrome.send('packExtensionSelectFilePath', [selectType, operation]); |
| 68 }, | 68 }, |
| 69 | 69 |
| 70 /** | 70 /** |
| 71 * Handles the showing of the extension directory browser. | 71 * Handles the showing of the extension directory browser. |
| 72 * @param {Event} e Change event. | 72 * @param {Event} e Change event. |
| 73 * @private | 73 * @private |
| 74 */ | 74 */ |
| 75 handleBrowseExtensionDir_: function(e) { | 75 handleBrowseExtensionDir_: function(e) { |
| 76 this.showFileDialog_('folder', 'load', function(filePath) { | 76 this.showFileDialog_('folder', 'load', function(filePath) { |
| 77 $('extensionRootDir').value = filePath; | 77 $('extensionRootDir').value = filePath; |
| 78 }); | 78 }); |
| 79 }, | 79 }, |
| 80 | 80 |
| 81 /** | 81 /** |
| 82 * Handles the showing of the extension private key file. | 82 * Handles the showing of the extension private key file. |
| 83 * @param {Event} e Change event. | 83 * @param {Event} e Change event. |
| 84 * @private | 84 * @private |
| 85 */ | 85 */ |
| 86 handleBrowsePrivateKey_: function(e) { | 86 handleBrowsePrivateKey_: function(e) { |
| 87 this.showFileDialog_('file', 'load', function(filePath) { | 87 this.showFileDialog_('file', 'pem', function(filePath) { |
| 88 $('extensionPrivateKey').value = filePath; | 88 $('extensionPrivateKey').value = filePath; |
| 89 }); | 89 }); |
| 90 }, | 90 }, |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 /** | 93 /** |
| 94 * Wrap up the pack process by showing the success |message| and closing | 94 * Wrap up the pack process by showing the success |message| and closing |
| 95 * the overlay. | 95 * the overlay. |
| 96 * @param {String} message The message to show to the user. | 96 * @param {String} message The message to show to the user. |
| 97 */ | 97 */ |
| (...skipping 28 matching lines...) Expand all Loading... |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 // Export | 128 // Export |
| 129 return { | 129 return { |
| 130 PackExtensionOverlay: PackExtensionOverlay | 130 PackExtensionOverlay: PackExtensionOverlay |
| 131 }; | 131 }; |
| 132 }); | 132 }); |
| 133 | 133 |
| 134 // Update the C++ call so this isn't necessary. | 134 // Update the C++ call so this isn't necessary. |
| 135 var PackExtensionOverlay = extensions.PackExtensionOverlay; | 135 var PackExtensionOverlay = extensions.PackExtensionOverlay; |
| OLD | NEW |