| 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 cef05de465b16adb28b4fdd9c3ec27cbaae51ab7..bacec08219b6cab1b0e6b6839d26a6cab9ac65f2 100644
|
| --- a/ui/file_manager/file_manager/foreground/js/directory_tree.js
|
| +++ b/ui/file_manager/file_manager/foreground/js/directory_tree.js
|
| @@ -36,6 +36,7 @@ DirectoryItemTreeBaseMethods.updateSubElementsFromList = function(recursive) {
|
| this.add(item);
|
| index++;
|
| } else if (util.isSameEntry(currentEntry, currentElement.entry)) {
|
| + currentElement.updateSharedStatusIcon();
|
| if (recursive && this.expanded)
|
| currentElement.updateSubDirectories(true /* recursive */);
|
|
|
| @@ -192,10 +193,12 @@ DirectoryItem.prototype.decorate = function(
|
| var icon = this.querySelector('.icon');
|
| icon.classList.add('volume-icon');
|
| var location = tree.volumeManager.getLocationInfo(dirEntry);
|
| - if (location && location.rootType && location.isRootEntry)
|
| + if (location && location.rootType && location.isRootEntry) {
|
| icon.setAttribute('volume-type-icon', location.rootType);
|
| - else
|
| + } else {
|
| icon.setAttribute('file-type-icon', 'folder');
|
| + this.updateSharedStatusIcon();
|
| + }
|
|
|
| if (this.parentTree_.contextMenuForSubitems)
|
| this.setContextMenu(this.parentTree_.contextMenuForSubitems);
|
| @@ -332,6 +335,19 @@ DirectoryItem.prototype.updateItemByEntry = function(changedDirectoryEntry) {
|
| };
|
|
|
| /**
|
| + * Update the icon based on whether the folder is shared on Drive.
|
| + */
|
| +DirectoryItem.prototype.updateSharedStatusIcon = function() {
|
| + var icon = this.querySelector('.icon');
|
| + this.parentTree_.metadataCache.get(
|
| + this.dirEntry_,
|
| + 'drive',
|
| + function(metadata) {
|
| + icon.classList.toggle('shared', metadata && metadata.shared);
|
| + });
|
| +};
|
| +
|
| +/**
|
| * Redraw subitems with the latest information. The items are sorted in
|
| * alphabetical order, case insensitive.
|
| * @param {boolean} recursive True if the update is recursively.
|
| @@ -395,10 +411,13 @@ function DirectoryTree() {}
|
| * @param {HTMLElement} el Element to be DirectoryTree.
|
| * @param {DirectoryModel} directoryModel Current DirectoryModel.
|
| * @param {VolumeManagerWrapper} volumeManager VolumeManager of the system.
|
| + * @param {MetadataCache} metadataCache Shared MetadataCache instance.
|
| */
|
| -DirectoryTree.decorate = function(el, directoryModel, volumeManager) {
|
| +DirectoryTree.decorate = function(
|
| + el, directoryModel, volumeManager, metadataCache) {
|
| el.__proto__ = DirectoryTree.prototype;
|
| - (/** @type {DirectoryTree} */ el).decorate(directoryModel, volumeManager);
|
| + (/** @type {DirectoryTree} */ el).decorate(
|
| + directoryModel, volumeManager, metadataCache);
|
| };
|
|
|
| DirectoryTree.prototype = {
|
| @@ -436,6 +455,14 @@ DirectoryTree.prototype = {
|
| get volumeManager() {
|
| return this.volumeManager_;
|
| },
|
| +
|
| + /**
|
| + * The reference to shared MetadataCache instance.
|
| + * @type {MetadataCache}
|
| + */
|
| + get metadataCache() {
|
| + return this.metadataCache_;
|
| + },
|
| };
|
|
|
| cr.defineProperty(DirectoryTree, 'contextMenuForSubitems', cr.PropertyKind.JS);
|
| @@ -466,13 +493,16 @@ DirectoryTree.prototype.searchAndSelectByEntry = function(entry) {
|
| * Decorates an element.
|
| * @param {DirectoryModel} directoryModel Current DirectoryModel.
|
| * @param {VolumeManagerWrapper} volumeManager VolumeManager of the system.
|
| + * @param {MetadataCache} metadataCache Shared MetadataCache instance.
|
| */
|
| -DirectoryTree.prototype.decorate = function(directoryModel, volumeManager) {
|
| +DirectoryTree.prototype.decorate = function(
|
| + directoryModel, volumeManager, metadataCache) {
|
| cr.ui.Tree.prototype.decorate.call(this);
|
|
|
| this.sequence_ = 0;
|
| this.directoryModel_ = directoryModel;
|
| this.volumeManager_ = volumeManager;
|
| + this.metadataCache_ = metadataCache;
|
| this.entries_ = [];
|
| this.currentVolumeInfo_ = null;
|
|
|
|
|