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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 /** | 54 /** |
55 * Utility function which asks the C++ to show a platform-specific file | 55 * Utility function which asks the C++ to show a platform-specific file |
56 * select dialog, and fire |callback| with the |filePath| that resulted. | 56 * select dialog, and fire |callback| with the |filePath| that resulted. |
57 * |selectType| can be either 'file' or 'folder'. |operation| can be 'load' | 57 * |selectType| can be either 'file' or 'folder'. |operation| can be 'load' |
58 * or 'pem' which are signals to the C++ to do some operation-specific | 58 * or 'pem' which are signals to the C++ to do some operation-specific |
59 * configuration. | 59 * configuration. |
60 * @private | 60 * @private |
61 */ | 61 */ |
62 showFileDialog_: function(selectType, operation, callback) { | 62 showFileDialog_: function(selectType, operation, callback) { |
63 handleFilePathSelected = function(filePath) { | 63 window.handleFilePathSelected = function(filePath) { |
64 callback(filePath); | 64 callback(filePath); |
65 handleFilePathSelected = function() {}; | 65 window.handleFilePathSelected = function() {}; |
66 }; | 66 }; |
67 | 67 |
68 chrome.send('packExtensionSelectFilePath', [selectType, operation]); | 68 chrome.send('packExtensionSelectFilePath', [selectType, operation]); |
69 }, | 69 }, |
70 | 70 |
71 /** | 71 /** |
72 * Handles the showing of the extension directory browser. | 72 * Handles the showing of the extension directory browser. |
73 * @param {Event} e Change event. | 73 * @param {Event} e Change event. |
74 * @private | 74 * @private |
75 */ | 75 */ |
(...skipping 21 matching lines...) Expand all Loading... |
97 * @param {string} message The message to show to the user. | 97 * @param {string} message The message to show to the user. |
98 */ | 98 */ |
99 PackExtensionOverlay.showSuccessMessage = function(message) { | 99 PackExtensionOverlay.showSuccessMessage = function(message) { |
100 alertOverlay.setValues( | 100 alertOverlay.setValues( |
101 loadTimeData.getString('packExtensionOverlay'), | 101 loadTimeData.getString('packExtensionOverlay'), |
102 message, | 102 message, |
103 loadTimeData.getString('ok'), | 103 loadTimeData.getString('ok'), |
104 '', | 104 '', |
105 function() { | 105 function() { |
106 extensions.ExtensionSettings.showOverlay(null); | 106 extensions.ExtensionSettings.showOverlay(null); |
107 }, | 107 }); |
108 null); | |
109 extensions.ExtensionSettings.showOverlay($('alertOverlay')); | 108 extensions.ExtensionSettings.showOverlay($('alertOverlay')); |
110 }; | 109 }; |
111 | 110 |
112 /** | 111 /** |
113 * Post an alert overlay showing |message|, and upon acknowledgement, close | 112 * Post an alert overlay showing |message|, and upon acknowledgement, close |
114 * the alert overlay and return to showing the PackExtensionOverlay. | 113 * the alert overlay and return to showing the PackExtensionOverlay. |
| 114 * @param {string} message The error message. |
115 */ | 115 */ |
116 PackExtensionOverlay.showError = function(message) { | 116 PackExtensionOverlay.showError = function(message) { |
117 alertOverlay.setValues( | 117 alertOverlay.setValues( |
118 loadTimeData.getString('packExtensionErrorTitle'), | 118 loadTimeData.getString('packExtensionErrorTitle'), |
119 message, | 119 message, |
120 loadTimeData.getString('ok'), | 120 loadTimeData.getString('ok'), |
121 '', | 121 '', |
122 function() { | 122 function() { |
123 extensions.ExtensionSettings.showOverlay($('pack-extension-overlay')); | 123 extensions.ExtensionSettings.showOverlay($('pack-extension-overlay')); |
124 }, | 124 }); |
125 null); | |
126 extensions.ExtensionSettings.showOverlay($('alertOverlay')); | 125 extensions.ExtensionSettings.showOverlay($('alertOverlay')); |
127 }; | 126 }; |
128 | 127 |
129 // Export | 128 // Export |
130 return { | 129 return { |
131 PackExtensionOverlay: PackExtensionOverlay | 130 PackExtensionOverlay: PackExtensionOverlay |
132 }; | 131 }; |
133 }); | 132 }); |
OLD | NEW |