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

Unified Diff: ui/file_manager/file_manager/foreground/js/directory_tree.js

Issue 279873002: Files.app: Handle change-by-keyboard in the directory tree (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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 | « ui/file_manager/file_manager/foreground/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: 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(
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/directory_model.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698