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

Recover gallery after crash in Files app.

Recent regression broke restoring the gallery view after crash. This patch fixes this issue. Along the way restoring archives has been removed, since the implementation is not reliable.

TEST=Tested manually.
BUG=333136

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244151 0039d316-1c4b-4281-b951-d872f2087c98
parent 6724686e
......@@ -1592,33 +1592,25 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52;
return;
var task = null;
if (opt_suggestedName) {
// Non-existent file or a directory.
if (this.params_.gallery) {
// Handle restoring after crash.
if (this.params_.gallery) {
if (!opt_selectionEntry) {
// Non-existent file or a directory.
// Reloading while the Gallery is open with empty or multiple
// selection. Open the Gallery when the directory is scanned.
task = function() {
new FileTasks(this, this.params_).openGallery([]);
}.bind(this);
}
} else if (opt_selectionEntry) {
// There is a file to be selected. It means, that we are recovering
// the Files app.
// We call the appropriate methods of FileTasks directly as we do
// not need any of the preparations that |execute| method does.
// TODO(mtomasz): Change Entry.fullPath to Entry.
var mediaType = FileType.getMediaType(opt_selectionEntry);
if (mediaType === 'image' || mediaType === 'video') {
} else {
// The file or the directory exists.
task = function() {
// TODO(mtomasz): Replace the url with an entry.
new FileTasks(this, this.params_).openGallery([opt_selectionEntry]);
}.bind(this);
} else if (mediaType === 'archive') {
task = function() {
new FileTasks(this, this.params_).mountArchives(
[opt_selectionEntry]);
}.bind(this);
}
} else {
// TODO(mtomasz): Implement remounting archives after crash.
// See: crbug.com/333139
}
// If there is a task to be run, run it after the scan is completed.
......@@ -2279,7 +2271,7 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52;
// TODO(mtomasz): Use Entry.toURL() instead of fullPath.
util.updateAppState(
this.getCurrentDirectoryEntry() &&
this.getCurrentDirectoryEntry().fullPath);
this.getCurrentDirectoryEntry().fullPath, '' /* opt_param */);
// If the current directory is moved from the device's volume, do not
// automatically close the window on device removal.
......
......@@ -640,10 +640,12 @@ Gallery.prototype.updateSelectionAndState_ = function() {
var path;
var displayName = '';
// TODO(mtomasz): Migrate fullPath to toURL().
var selectedItems = this.getSelectedItems();
if (selectedItems.length === 1) {
var item = selectedItems[0];
var entry = item.getEntry();
path = entry.fullPath;
window.top.document.title = entry.name;
displayName = ImageUtil.getDisplayNameFromName(entry.name);
} else if (selectedItems.length > 1 && this.context_.curDirEntry) {
......
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