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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * This object encapsulates everything related to tasks execution. | 8 * This object encapsulates everything related to tasks execution. |
9 * | 9 * |
10 * @param {FileManager} fileManager FileManager instance. | 10 * @param {FileManager} fileManager FileManager instance. |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 * @private | 549 * @private |
550 */ | 550 */ |
551 FileTasks.prototype.mountArchivesInternal_ = function(entries) { | 551 FileTasks.prototype.mountArchivesInternal_ = function(entries) { |
552 var fm = this.fileManager_; | 552 var fm = this.fileManager_; |
553 | 553 |
554 var tracker = fm.directoryModel_.createDirectoryChangeTracker(); | 554 var tracker = fm.directoryModel_.createDirectoryChangeTracker(); |
555 tracker.start(); | 555 tracker.start(); |
556 | 556 |
557 // TODO(mtomasz): Pass Entries instead of URLs. | 557 // TODO(mtomasz): Pass Entries instead of URLs. |
558 var urls = util.entriesToURLs(entries); | 558 var urls = util.entriesToURLs(entries); |
559 fm.resolveSelectResults_(urls, function(entries) { | 559 fm.resolveSelectResults_(urls, function(resolvedURLs) { |
560 for (var index = 0; index < entries.length; ++index) { | 560 for (var index = 0; index < resolvedURLs.length; ++index) { |
561 // TODO(mtomasz): Pass Entry instead of URL. | 561 // TODO(mtomasz): Pass Entry instead of URL. |
562 fm.volumeManager_.mountArchive(entries[index].toURL(), | 562 fm.volumeManager_.mountArchive(resolvedURLs[index], |
563 function(mountPath) { | 563 function(mountPath) { |
564 tracker.stop(); | 564 tracker.stop(); |
565 if (!tracker.hasChanged) | 565 if (!tracker.hasChanged) |
566 fm.directoryModel_.changeDirectory(mountPath); | 566 fm.directoryModel_.changeDirectory(mountPath); |
567 }, function(entry, error) { | 567 }, function(url, error) { |
568 tracker.stop(); | 568 tracker.stop(); |
569 fm.alert.show(strf('ARCHIVE_MOUNT_FAILED', entry.name, error)); | 569 var path = util.extractFilePath(url); |
570 }.bind(null, entries[index])); | 570 var namePos = path.lastIndexOf('/'); |
| 571 fm.alert.show(strf('ARCHIVE_MOUNT_FAILED', |
| 572 path.substr(namePos + 1), error)); |
| 573 }.bind(null, resolvedURLs[index])); |
571 } | 574 } |
572 }); | 575 }); |
573 }; | 576 }; |
574 | 577 |
575 /** | 578 /** |
576 * Open the Gallery. | 579 * Open the Gallery. |
577 * | 580 * |
578 * @param {Array.<Entry>} entries List of selected entries. | 581 * @param {Array.<Entry>} entries List of selected entries. |
579 */ | 582 */ |
580 FileTasks.prototype.openGallery = function(entries) { | 583 FileTasks.prototype.openGallery = function(entries) { |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 items, defaultIdx, | 814 items, defaultIdx, |
812 function(item) { | 815 function(item) { |
813 onSuccess(item.task); | 816 onSuccess(item.task); |
814 }); | 817 }); |
815 }; | 818 }; |
816 | 819 |
817 FileTasks.decorate('display'); | 820 FileTasks.decorate('display'); |
818 FileTasks.decorate('updateMenuItem'); | 821 FileTasks.decorate('updateMenuItem'); |
819 FileTasks.decorate('execute'); | 822 FileTasks.decorate('execute'); |
820 FileTasks.decorate('executeDefault'); | 823 FileTasks.decorate('executeDefault'); |
OLD | NEW |