Commit a82efafe authored by mtomasz@chromium.org's avatar mtomasz@chromium.org

Fix broken task handling in Files app.

This patch fixes a recent regression caused by refactoring paths to Entries. It is mounting and archive, and recovering after crash.

TEST=Tested manually by mounting a zip file.
BUG=326037

Review URL: https://codereview.chromium.org/104643004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239191 0039d316-1c4b-4281-b951-d872f2087c98
parent 2f1be486
......@@ -1520,13 +1520,12 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52;
if (mediaType == 'image' || mediaType == 'video') {
task = function() {
// TODO(mtomasz): Replace the url with an entry.
new FileTasks(this, this.params_).openGallery(
[opt_selectionEntry.toURL()]);
new FileTasks(this, this.params_).openGallery([opt_selectionEntry]);
}.bind(this);
} else if (mediaType == 'archive') {
task = function() {
new FileTasks(this, this.params_).mountArchives(
[opt_selectionEntry.toURL()]);
[opt_selectionEntry]);
}.bind(this);
}
}
......
......@@ -559,18 +559,21 @@ FileTasks.prototype.mountArchivesInternal_ = function(entries) {
// TODO(mtomasz): Pass Entries instead of URLs.
var urls = util.entriesToURLs(entries);
fm.resolveSelectResults_(urls, function(entries) {
for (var index = 0; index < entries.length; ++index) {
fm.resolveSelectResults_(urls, function(resolvedURLs) {
for (var index = 0; index < resolvedURLs.length; ++index) {
// TODO(mtomasz): Pass Entry instead of URL.
fm.volumeManager_.mountArchive(entries[index].toURL(),
fm.volumeManager_.mountArchive(resolvedURLs[index],
function(mountPath) {
tracker.stop();
if (!tracker.hasChanged)
fm.directoryModel_.changeDirectory(mountPath);
}, function(entry, error) {
}, function(url, error) {
tracker.stop();
fm.alert.show(strf('ARCHIVE_MOUNT_FAILED', entry.name, error));
}.bind(null, entries[index]));
var path = util.extractFilePath(url);
var namePos = path.lastIndexOf('/');
fm.alert.show(strf('ARCHIVE_MOUNT_FAILED',
path.substr(namePos + 1), error));
}.bind(null, resolvedURLs[index]));
}
});
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment