Chromium Code Reviews| 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. |