Commit ca740afd authored by Luciano Pacheco's avatar Luciano Pacheco Committed by Commit Bot

Keep Drive expanded when My files is disabled

Change NavigationListModel to expose the flag state and use it from
DriveVolumeItem to only expand if My files is disabled.

Fix comment comment changed in crrev.com/c/1141454.

browser tests check for collapsed behaviour.

Test: Manually checked that Drive is expanded when flag is disabled,
Bug: 864291
Cq-Include-Trybots: luci.chromium.try:closure_compilation
Change-Id: Iff2c364ce5ad8d50dfd8f7850d9773c8ddf47b3d
Reviewed-on: https://chromium-review.googlesource.com/1143044Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#576399}
parent 0b4ed803
...@@ -428,6 +428,10 @@ NavigationListModel.prototype = { ...@@ -428,6 +428,10 @@ NavigationListModel.prototype = {
this.linuxFilesItem_ = item; this.linuxFilesItem_ = item;
this.reorderNavigationItems_(); this.reorderNavigationItems_();
}, },
/** @type {boolean} */
get disableMyFilesNavigation() {
return this.disableMyFilesNavigation_;
}
}; };
/** /**
......
...@@ -1049,6 +1049,10 @@ DriveVolumeItem.prototype.updateSubDirectories = function(recursive) { ...@@ -1049,6 +1049,10 @@ DriveVolumeItem.prototype.updateSubDirectories = function(recursive) {
this.add(item); this.add(item);
item.updateSubDirectories(false); item.updateSubDirectories(false);
} }
// When My files is disabled Drive should be expanded by default.
// TODO(crbug.com/850348): Remove this once flag is removed.
if (this.parentTree_.dataModel.disableMyFilesNavigation)
this.expanded = true;
}; };
/** /**
...@@ -1628,8 +1632,8 @@ DirectoryTree.prototype.updateSubElementsFromList = function(recursive) { ...@@ -1628,8 +1632,8 @@ DirectoryTree.prototype.updateSubElementsFromList = function(recursive) {
if (recursive && currentItem instanceof VolumeItem) if (recursive && currentItem instanceof VolumeItem)
currentItem.updateSubDirectories(true); currentItem.updateSubDirectories(true);
// EntryListItem can contain volumes that might have been updated: ask // EntryListItem can contain volumes that might have been updated: ask
// them to re-draw. It only needs to update the first level of children, // them to re-draw. Updates recursively so any created or removed children
// so it doesn't need to be recursive. // folder can be reflected on directory tree.
if (currentItem instanceof EntryListItem) if (currentItem instanceof EntryListItem)
currentItem.updateSubDirectories(true); currentItem.updateSubDirectories(true);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment