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

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

Issue 22167002: Cleanup: Remove unnecessary property: VolumeList.currentVolume_ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comment Created 7 years, 4 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/js/volume_list.js
diff --git a/chrome/browser/resources/file_manager/js/volume_list.js b/chrome/browser/resources/file_manager/js/volume_list.js
index e27301c40cd03e2753c286c7b83605a754dd77d1..792e75e281fae111fbe6c5c268706376c5d940b8 100644
--- a/chrome/browser/resources/file_manager/js/volume_list.js
+++ b/chrome/browser/resources/file_manager/js/volume_list.js
@@ -186,8 +186,6 @@ VolumeList.prototype.decorate = function(directoryModel, pinnedFolderModel) {
'change', this.onSelectionChange_.bind(this));
this.selectionModel.addEventListener(
'beforeChange', this.onBeforeSelectionChange_.bind(this));
- this.currentVolume_ = null;
-
this.scrollBar_ = new ScrollBar();
this.scrollBar_.initialize(this.parentNode, this);
@@ -314,11 +312,14 @@ VolumeList.prototype.selectByIndex = function(index) {
return false;
var newPath = this.dataModel.item(index);
- if (!newPath || this.currentVolume_ == newPath)
+ if (!newPath)
+ return false;
+
+ // Prevents double-moving to the current directory.
mtomasz 2013/08/06 03:46:20 The problem here is that it won't work when being
mtomasz 2013/08/06 03:48:35 Sorry, I misunderstood this method. Please ignore
+ if (this.directoryModel_.getCurrentDirEntry().fullPath == newPath)
return false;
- this.currentVolume_ = newPath;
- this.directoryModel_.changeDirectory(this.currentVolume_);
+ this.directoryModel_.changeDirectory(newPath);
return true;
};
@@ -355,10 +356,6 @@ VolumeList.prototype.onCurrentDirectoryChanged_ = function(event) {
var path = event.newDirEntry.fullPath || this.dataModel.getCurrentDirPath();
var newRootPath = PathUtil.getRootPath(path);
- // Sets |this.currentVolume_| in advance to prevent |onSelectionChange_()|
- // from calling |DirectoryModel.ChangeDirectory()| again.
- this.currentVolume_ = newRootPath;
-
// Synchronizes the volume list selection with the current directory, after
// it is changed outside of the volume list.
« 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