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

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

Issue 307053002: Revert of Change directory if the active list item on navigation list is changed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/background/js/test_util.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/ui/navigation_list.js
diff --git a/ui/file_manager/file_manager/foreground/js/ui/navigation_list.js b/ui/file_manager/file_manager/foreground/js/ui/navigation_list.js
index 22bad9adcf500c7bdf57a20755cc07cbde6d8b25..4368c9bef67dde49ab94587971f2ae3dc2874e9e 100644
--- a/ui/file_manager/file_manager/foreground/js/ui/navigation_list.js
+++ b/ui/file_manager/file_manager/foreground/js/ui/navigation_list.js
@@ -201,9 +201,6 @@
this.scrollBar_ = new ScrollBar();
this.scrollBar_.initialize(this.parentNode, this);
- // Keeps track of selected model item to detect if it is changed actually.
- this.currentModelItem_ = null;
-
// Overriding default role 'list' set by cr.ui.List.decorate() to 'listbox'
// role for better accessibility on ChromeOS.
this.setAttribute('role', 'listbox');
@@ -290,7 +287,6 @@
if (index < 0 || index > this.dataModel.length - 1)
return false;
- this.selectionModel.selectedIndex = index;
this.activateModelItem_(this.dataModel.item(index));
return true;
};
@@ -303,11 +299,16 @@
*/
NavigationList.prototype.activateModelItem_ = function(modelItem) {
var onEntryResolved = function(entry) {
- // Change directory to the model item's root directory if needed.
- if (!util.isSameEntry(this.directoryModel_.getCurrentDirEntry(), entry)) {
- metrics.recordUserAction('FolderShortcut.Navigate');
- this.directoryModel_.changeDirectoryEntry(entry);
+ // If the root item of active directory was same as newly activated
+ // root item, keep the active directory as it was.
+ var currentDir = this.directoryModel_.getCurrentDirEntry();
+ if (util.isSameEntry(entry, currentDir) ||
+ util.isDescendantEntry(entry, currentDir)) {
+ return;
}
+
+ metrics.recordUserAction('FolderShortcut.Navigate');
+ this.directoryModel_.changeDirectoryEntry(entry);
}.bind(this);
if (modelItem.isVolume) {
@@ -349,25 +350,12 @@
* @private
*/
NavigationList.prototype.onSelectionChange_ = function(event) {
- var index = this.selectionModel.selectedIndex;
- if (index < 0 || index > this.dataModel.length - 1)
- return;
-
- // If the selected model item is not changed actually, we don't change the
- // current directory even if the selected index is changed.
- var modelItem = this.dataModel.item(index);
- if (modelItem === this.currentModelItem_)
- return;
-
- // Remember the selected model item.
- this.currentModelItem_ = modelItem;
-
// This handler is invoked even when the navigation list itself changes the
// selection. In such case, we shouldn't handle the event.
if (this.dontHandleSelectionEvent_)
return;
- this.activateModelItem_(modelItem);
+ this.selectByIndex(this.selectionModel.selectedIndex);
};
/**
« no previous file with comments | « ui/file_manager/file_manager/background/js/test_util.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698