Commit 97d8b563 authored by yoshiki@chromium.org's avatar yoshiki@chromium.org

Cleanup: Remove unnecessary property: VolumeList.currentVolume_

This property can be removed. This patch also fixes a small bug on changing the selection on the list.

BUG=none
TEST=manual
R=mtomasz@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215817 0039d316-1c4b-4281-b951-d872f2087c98
parent bd7a30c7
...@@ -186,8 +186,6 @@ VolumeList.prototype.decorate = function(directoryModel, pinnedFolderModel) { ...@@ -186,8 +186,6 @@ VolumeList.prototype.decorate = function(directoryModel, pinnedFolderModel) {
'change', this.onSelectionChange_.bind(this)); 'change', this.onSelectionChange_.bind(this));
this.selectionModel.addEventListener( this.selectionModel.addEventListener(
'beforeChange', this.onBeforeSelectionChange_.bind(this)); 'beforeChange', this.onBeforeSelectionChange_.bind(this));
this.currentVolume_ = null;
this.scrollBar_ = new ScrollBar(); this.scrollBar_ = new ScrollBar();
this.scrollBar_.initialize(this.parentNode, this); this.scrollBar_.initialize(this.parentNode, this);
...@@ -314,11 +312,14 @@ VolumeList.prototype.selectByIndex = function(index) { ...@@ -314,11 +312,14 @@ VolumeList.prototype.selectByIndex = function(index) {
return false; return false;
var newPath = this.dataModel.item(index); var newPath = this.dataModel.item(index);
if (!newPath || this.currentVolume_ == newPath) if (!newPath)
return false;
// Prevents double-moving to the current directory.
if (this.directoryModel_.getCurrentDirEntry().fullPath == newPath)
return false; return false;
this.currentVolume_ = newPath; this.directoryModel_.changeDirectory(newPath);
this.directoryModel_.changeDirectory(this.currentVolume_);
return true; return true;
}; };
...@@ -355,10 +356,6 @@ VolumeList.prototype.onCurrentDirectoryChanged_ = function(event) { ...@@ -355,10 +356,6 @@ VolumeList.prototype.onCurrentDirectoryChanged_ = function(event) {
var path = event.newDirEntry.fullPath || this.dataModel.getCurrentDirPath(); var path = event.newDirEntry.fullPath || this.dataModel.getCurrentDirPath();
var newRootPath = PathUtil.getRootPath(path); 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 // Synchronizes the volume list selection with the current directory, after
// it is changed outside of the volume list. // it is changed outside of the volume list.
......
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