Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3410)

Unified Diff: chrome/browser/resources/file_manager/foreground/js/file_manager.js

Issue 124933002: Fix restoring after a crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed another bug. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/file_manager/foreground/js/file_manager.js
diff --git a/chrome/browser/resources/file_manager/foreground/js/file_manager.js b/chrome/browser/resources/file_manager/foreground/js/file_manager.js
index 793d423ca3dff0344211c33ea25473b56e057c88..6ddf9b80615d70537c0ec7d0e42040dda966113e 100644
--- a/chrome/browser/resources/file_manager/foreground/js/file_manager.js
+++ b/chrome/browser/resources/file_manager/foreground/js/file_manager.js
@@ -1481,7 +1481,7 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52;
}
if (candidateEntry) {
- // The entry is directry. Use it.
+ // The entry is directory. Use it.
if (candidateEntry.isDirectory) {
nextCurrentDirEntry = candidateEntry;
callback();
@@ -1502,19 +1502,40 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52;
}
// If the entry doesn't exist, most probably because the path contains a
- // suggested name. Therefore try to open its parent.
+ // suggested name. Therefore try to open its parent. However, the parent
+ // may also not exist. In such situation, fallback.
var pathNodes = candidateFullPath.split('/');
- suggestedName = pathNodes.pop();
+ var baseName = pathNodes.pop();
var parentPath = pathNodes.join('/');
this.volumeManager_.resolveAbsolutePath(
parentPath,
function(parentEntry) {
nextCurrentDirEntry = parentEntry;
+ suggestedName = baseName;
callback();
},
function() {
hirono 2014/01/06 10:20:11 We can pass the callback directly.
mtomasz 2014/01/07 00:52:10 Done.
- error = new Error('Failed to setup an initial directory: ' +
- nextCurrentDirPath);
+ callback();
+ });
+ }.bind(this));
+
+ queue.run(function(callback) {
+ // If the directory is not set at this stage, fallback to the default
+ // mount point.
+ if (nextCurrentDirEntry) {
+ callback();
+ return;
+ }
+ this.volumeManager_.resolveAbsolutePath(
+ PathUtil.DEFAULT_MOUNT_POINT,
+ function(fallbackEntry) {
+ nextCurrentDirEntry = fallbackEntry;
+ callback();
+ },
+ function() {
+ // Fallback directory not available? Throw an error.
+ error = new Error('Unable to resolve the fallback directory: ' +
+ PathUtil.DEFAULT_MOUNT_POINT);
callback();
});
}.bind(this));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698