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

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

Issue 10146008: Remember current directory for each volume. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 | « chrome/browser/resources/file_manager/js/directory_model.js ('k') | 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/js/file_manager.js
===================================================================
--- chrome/browser/resources/file_manager/js/file_manager.js (revision 133417)
+++ chrome/browser/resources/file_manager/js/file_manager.js (working copy)
@@ -768,10 +768,11 @@
return self.renderRoot_(entry);
};
- this.rootsList_.selectionModel = this.directoryModel_.rootsListSelection;
+ this.rootsList_.selectionModel =
+ this.directoryModel_.getRootsListSelectionModel();
// TODO(dgozman): add "Add a drive" item.
- this.rootsList_.dataModel = this.directoryModel_.rootsList;
+ this.rootsList_.dataModel = this.directoryModel_.getRootsList();
this.directoryModel_.updateRoots(function() {
self.rootsList_.endBatchUpdates();
}, false);
@@ -1117,8 +1118,7 @@
return true;
case 'format':
- var entry =
- this.getRootEntry_(this.rootsList_.selectionModel.selectedIndex);
+ var entry = this.directoryModel_.getCurrentRootDirEntry();
return entry && DirectoryModel.getRootType(entry.fullPath) ==
DirectoryModel.RootType.REMOVABLE;
@@ -1407,16 +1407,11 @@
return;
case 'unmount':
- var entry =
- this.getRootEntry_(this.rootsList_.selectionModel.selectedIndex);
-
- this.unmountVolume_(entry);
+ this.unmountVolume_(this.directoryModel_.getCurrentRootDirEntry());
return;
case 'format':
- var entry =
- this.getRootEntry_(this.rootsList_.selectionModel.selectedIndex);
-
+ var entry = this.directoryModel_.getCurrentRootDirEntry();
this.confirm.show(str('FORMATTING_WARNING'), function() {
chrome.fileBrowserPrivate.formatDevice(entry.toURL());
});
@@ -1823,6 +1818,21 @@
return path;
};
+ /**
+ * Handler for root item being clicked.
+ * @private
+ * @param {Entry} entry Entry to navigate to.
+ * @param {Event} event The event.
+ */
+ FileManager.prototype.onRootClick_ = function(entry, event) {
+ var new_path = entry.fullPath;
+ if (entry.fullPath == this.directoryModel_.getCurrentRootPath()) {
+ this.directoryModel_.changeDirectory(entry.fullPath);
+ } else {
+ this.directoryModel_.changeRoot(entry.fullPath);
+ }
+ };
+
FileManager.prototype.renderRoot_ = function(entry) {
var li = this.document_.createElement('li');
li.className = 'root-item';
@@ -1874,18 +1884,6 @@
};
/**
- * Handler for root item being clicked.
- * @param {Entry} entry to navigate to.
- * @param {Event} event The event.
- */
- FileManager.prototype.onRootClick_ = function(entry, event) {
- var path = this.directoryModel_.currentEntry.fullPath;
- if (path.indexOf(entry.fullPath) == 0 && path != entry.fullPath) {
- this.directoryModel_.changeDirectory(entry.fullPath);
- }
- };
-
- /**
* Unmounts device.
* @param {Entry} entry The entry to unmount.
*/
@@ -2387,7 +2385,8 @@
FileManager.prototype.isOnGData = function() {
return this.directoryModel_ &&
- this.directoryModel_.rootPath == '/' + DirectoryModel.GDATA_DIRECTORY;
+ this.directoryModel_.getCurrentRootPath() ==
+ '/' + DirectoryModel.GDATA_DIRECTORY;
};
FileManager.prototype.getMetadataProvider = function() {
@@ -2649,7 +2648,7 @@
} else if (this.isOnGData() &&
this.directoryModel_.currentEntry.unmounted) {
// We are currently on an unmounted GData directory, force a rescan.
- changeDirectoryTo = this.directoryModel_.rootPath;
+ changeDirectoryTo = this.directoryModel_.getCurrentRootPath();
}
} else {
this.gdataMounted_ = false;
@@ -2695,7 +2694,7 @@
}
if (event.status == 'success' &&
- event.mountPath == self.directoryModel_.rootPath) {
+ event.mountPath == self.directoryModel_.getCurrentRootPath()) {
if (self.params_.mountTriggered && index == -1) {
// This device mount was the reason this File Manager instance was
// created. Now the device is unmounted from another instance
@@ -2847,7 +2846,7 @@
// until we learn to save files directly to GData.
var readonly = self.isOnReadonlyDirectory() || self.isOnGData();
var currentDir = self.directoryModel_.currentEntry;
- var downloadsDir = self.directoryModel_.rootsList.item(0);
+ var downloadsDir = self.directoryModel_.getRootsList().item(0);
var context = {
// We show the root label in readonly warning (e.g. archive name).
@@ -2883,7 +2882,7 @@
var bc = this.dialogDom_.querySelector('.breadcrumbs');
removeChildren(bc);
- var rootPath = this.directoryModel_.rootPath;
+ var rootPath = this.directoryModel_.getCurrentRootPath();
var relativePath = this.directoryModel_.currentEntry.fullPath.
substring(rootPath.length).replace(/\/$/, '');
« no previous file with comments | « chrome/browser/resources/file_manager/js/directory_model.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698