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 /** | 5 /** |
6 * This object encapsulates everything related to tasks execution. | 6 * This object encapsulates everything related to tasks execution. |
7 * @param {FileManager} fileManager FileManager instance. | 7 * @param {FileManager} fileManager FileManager instance. |
8 * @param {object} opt_params File manager load parameters. | 8 * @param {object} opt_params File manager load parameters. |
9 */ | 9 */ |
10 function FileTasks(fileManager, opt_params) { | 10 function FileTasks(fileManager, opt_params) { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 /** | 191 /** |
192 * Executes a single task. | 192 * Executes a single task. |
193 * @param {string} taskId Task identifier. | 193 * @param {string} taskId Task identifier. |
194 * @param {Array.<string>=} opt_urls Urls to execute on instead of |this.urls_|. | 194 * @param {Array.<string>=} opt_urls Urls to execute on instead of |this.urls_|. |
195 * @private | 195 * @private |
196 */ | 196 */ |
197 FileTasks.prototype.execute_ = function(taskId, opt_urls) { | 197 FileTasks.prototype.execute_ = function(taskId, opt_urls) { |
198 var urls = opt_urls || this.urls_; | 198 var urls = opt_urls || this.urls_; |
199 this.checkAvailability_(function() { | 199 this.checkAvailability_(function() { |
200 chrome.fileBrowserPrivate.executeTask(taskId, urls); | |
201 | |
202 var task_parts = taskId.split('|'); | 200 var task_parts = taskId.split('|'); |
203 if (task_parts[0] == util.platform.getAppId() && task_parts[1] == 'file') { | 201 if (task_parts[0] == util.platform.getAppId() && task_parts[1] == 'file') { |
204 // For internal tasks we do not listen to the event to avoid | 202 // For internal tasks we do not listen to the event to avoid |
205 // handling the same task instance from multiple tabs. | 203 // handling the same task instance from multiple tabs. |
206 // So, we manually execute the task. | 204 // So, we manually execute the task. |
207 this.executeInternalTask_(task_parts[2], urls); | 205 this.executeInternalTask_(task_parts[2], urls); |
| 206 } else { |
| 207 chrome.fileBrowserPrivate.executeTask(taskId, urls); |
208 } | 208 } |
209 }.bind(this)); | 209 }.bind(this)); |
210 }; | 210 }; |
211 | 211 |
212 /** | 212 /** |
213 * Checks whether the remote files are available right now. | 213 * Checks whether the remote files are available right now. |
214 * @param {function} callback The callback. | 214 * @param {function} callback The callback. |
215 * @private | 215 * @private |
216 */ | 216 */ |
217 FileTasks.prototype.checkAvailability_ = function(callback) { | 217 FileTasks.prototype.checkAvailability_ = function(callback) { |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 message, | 568 message, |
569 items, defaultIdx, | 569 items, defaultIdx, |
570 onSuccess); | 570 onSuccess); |
571 }; | 571 }; |
572 | 572 |
573 FileTasks.decorate('display'); | 573 FileTasks.decorate('display'); |
574 FileTasks.decorate('updateMenuItem'); | 574 FileTasks.decorate('updateMenuItem'); |
575 FileTasks.decorate('execute'); | 575 FileTasks.decorate('execute'); |
576 FileTasks.decorate('executeDefault'); | 576 FileTasks.decorate('executeDefault'); |
577 | 577 |
OLD | NEW |