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 * | 7 * |
8 * TODO(hirono): Pass each component instead of the entire FileManager. | 8 * TODO(hirono): Pass each component instead of the entire FileManager. |
9 * @param {FileManager} fileManager FileManager instance. | 9 * @param {FileManager} fileManager FileManager instance. |
10 * @constructor | 10 * @constructor |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 } | 366 } |
367 | 367 |
368 var webStoreUrl = FileTasks.createWebStoreLink(extension, mimeType); | 368 var webStoreUrl = FileTasks.createWebStoreLink(extension, mimeType); |
369 var text = strf(textMessageId, webStoreUrl, str('NO_ACTION_FOR_FILE_URL')); | 369 var text = strf(textMessageId, webStoreUrl, str('NO_ACTION_FOR_FILE_URL')); |
370 var title = titleMessageId ? str(titleMessageId) : filename; | 370 var title = titleMessageId ? str(titleMessageId) : filename; |
371 this.fileManager_.ui.alertDialog.showHtml(title, text, null, null, null); | 371 this.fileManager_.ui.alertDialog.showHtml(title, text, null, null, null); |
372 callback(false, entries); | 372 callback(false, entries); |
373 }.bind(this); | 373 }.bind(this); |
374 | 374 |
375 var onViewFilesFailure = function() { | 375 var onViewFilesFailure = function() { |
376 var fm = this.fileManager_; | 376 var fileManager = this.fileManager_; |
377 if (!fm.isOnDrive() || | 377 |
378 !entries[0] || | 378 if (FileTasks.EXTENSIONS_TO_SKIP_SUGGEST_APPS_.indexOf(extension) !== -1 || |
379 FileTasks.EXTENSIONS_TO_SKIP_SUGGEST_APPS_.indexOf(extension) !== -1) { | 379 FileTasks.EXECUTABLE_EXTENSIONS.indexOf(extension) !== -1) { |
380 showAlert(); | 380 showAlert(); |
381 return; | 381 return; |
382 } | 382 } |
383 | 383 |
384 fm.taskController.openSuggestAppsDialog( | 384 fileManager.taskController.openSuggestAppsDialog( |
385 entries[0], | 385 entries[0], |
386 function() { | 386 function() { |
387 var newTasks = new FileTasks(fm); | 387 var newTasks = new FileTasks(fileManager); |
388 newTasks.init(entries, this.mimeTypes_); | 388 newTasks.init(entries, this.mimeTypes_); |
389 newTasks.executeDefault(); | 389 newTasks.executeDefault(); |
390 callback(true, entries); | 390 callback(true, entries); |
391 }.bind(this), | 391 }.bind(this), |
392 // Cancelled callback. | 392 // Cancelled callback. |
393 function() { | 393 function() { |
394 callback(false, entries); | 394 callback(false, entries); |
395 }, | 395 }, |
396 showAlert); | 396 showAlert); |
397 }.bind(this); | 397 }.bind(this); |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 * | 799 * |
800 * @param {function(boolean, Array.<Entry>)=} opt_callback Called when the | 800 * @param {function(boolean, Array.<Entry>)=} opt_callback Called when the |
801 * default task is executed, or the error is occurred. | 801 * default task is executed, or the error is occurred. |
802 */ | 802 */ |
803 FileTasks.prototype.executeDefault = function(opt_callback) { | 803 FileTasks.prototype.executeDefault = function(opt_callback) { |
804 if (this.tasks_) | 804 if (this.tasks_) |
805 this.executeDefault_(opt_callback); | 805 this.executeDefault_(opt_callback); |
806 else | 806 else |
807 this.pendingInvocations_.push(['executeDefault_', [opt_callback]]); | 807 this.pendingInvocations_.push(['executeDefault_', [opt_callback]]); |
808 }; | 808 }; |
OLD | NEW |