Index: ui/file_manager/file_manager/foreground/js/directory_tree.js |
diff --git a/ui/file_manager/file_manager/foreground/js/directory_tree.js b/ui/file_manager/file_manager/foreground/js/directory_tree.js |
index 50f2083016afb52473167817ac487082c10df4c2..2010ad700c317afcb2770689701ddd4b4dad08de 100644 |
--- a/ui/file_manager/file_manager/foreground/js/directory_tree.js |
+++ b/ui/file_manager/file_manager/foreground/js/directory_tree.js |
@@ -256,19 +256,8 @@ DirectoryItem.prototype.onExpand_ = function(e) { |
*/ |
DirectoryItem.prototype.handleClick = function(e) { |
cr.ui.TreeItem.prototype.handleClick.call(this, e); |
- |
- if (e.target.classList.contains('expand-icon')) |
- return; |
- |
- var currentDirectoryEntry = this.directoryModel_.getCurrentDirEntry(); |
- if (currentDirectoryEntry && |
- util.isSameEntry(this.entry, currentDirectoryEntry)) { |
- // On clicking the current directory, clears the selection on the file list. |
- this.directoryModel_.clearSelection(); |
- } else { |
- // Otherwise, changes the current directory. |
- this.directoryModel_.changeDirectoryEntry(this.entry); |
- } |
+ if (!e.target.classList.contains('expand-icon')) |
+ this.directoryModel_.activateDirectoryEntry(this.entry); |
}; |
/** |
@@ -493,6 +482,12 @@ DirectoryTree.prototype.decorate = function(directoryModel, volumeManager) { |
this.directoryModel_.addEventListener('directory-changed', |
this.onCurrentDirectoryChanged_.bind(this)); |
+ // Add a handler for directory change. |
+ this.addEventListener('change', function() { |
+ if (this.selectedItem) |
+ this.directoryModel_.activateDirectoryEntry(this.selectedItem.entry); |
+ }.bind(this)); |
+ |
this.privateOnDirectoryChangedBound_ = |
this.onDirectoryContentChanged_.bind(this); |
chrome.fileBrowserPrivate.onDirectoryChanged.addListener( |