summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfukino@chromium.org <fukino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-28 11:52:41 +0000
committerfukino@chromium.org <fukino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-28 11:52:41 +0000
commit2f383bbe683a27ef06bd97c8375008b1f98742d6 (patch)
tree53fe57bb06480fb87ef115fca57be1ea1eb033f5
parentf1e9e89831b4000f983ab2099312aeb52e022be2 (diff)
downloadchromium_src-2f383bbe683a27ef06bd97c8375008b1f98742d6.zip
chromium_src-2f383bbe683a27ef06bd97c8375008b1f98742d6.tar.gz
chromium_src-2f383bbe683a27ef06bd97c8375008b1f98742d6.tar.bz2
Keep active directory when same root item on navigation list is activated.
NavigationList's activeModelItem_() is called even when the actual active model is not changed. It occurs when the list items on navigation list are permutated by mounting/unmounting devices. This patch checks if the actual active model is changed. Code for clearing selection on clicking root items is moved to click event handler. BUG=361047 TEST=manually tested ran browser_tests gtest_filter=*FileManager* Review URL: https://codereview.chromium.org/251483002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266507 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ui/file_manager/file_manager/foreground/js/ui/navigation_list.js10
1 files changed, 7 insertions, 3 deletions
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 75ae1d8..2092fdb 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
@@ -225,6 +225,8 @@ NavigationList.prototype.renderRoot_ = function(modelItem) {
if (!item.selected)
return;
this.activateModelItem_(item.modelItem);
+ // On clicking the root item, clears the selection.
+ this.directoryModel_.clearSelection();
}.bind(this);
item.addEventListener('click', handleClick);
@@ -278,9 +280,11 @@ NavigationList.prototype.selectByIndex = function(index) {
*/
NavigationList.prototype.activateModelItem_ = function(modelItem) {
var onEntryResolved = function(entry) {
- if (util.isSameEntry(this.directoryModel_.getCurrentDirEntry(), entry)) {
- // On clicking the current directory, clears the selection.
- this.directoryModel_.clearSelection();
+ // 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;
}