Chromium Code Reviews| Index: ui/file_manager/file_manager/foreground/js/ui/file_grid.js |
| diff --git a/ui/file_manager/file_manager/foreground/js/ui/file_grid.js b/ui/file_manager/file_manager/foreground/js/ui/file_grid.js |
| index 7a05e83619df3a1aaefd353001559ff632cb3f27..407b9f796a2f09c60eb47af798a6da625f0da672 100644 |
| --- a/ui/file_manager/file_manager/foreground/js/ui/file_grid.js |
| +++ b/ui/file_manager/file_manager/foreground/js/ui/file_grid.js |
| @@ -161,6 +161,7 @@ FileGrid.prototype.updateListItemsMetadata = function(type, entries) { |
| continue; |
| this.decorateThumbnailBox_(assertInstanceof(box, HTMLDivElement), entry); |
| + this.updateSharedStatus_(assert(listItem), entry); |
| } |
| }; |
| @@ -219,6 +220,8 @@ FileGrid.prototype.decorateThumbnail_ = function(li, entry) { |
| bottom.appendChild(filelist.renderFileTypeIcon(li.ownerDocument, entry)); |
| bottom.appendChild(filelist.renderFileNameLabel(li.ownerDocument, entry)); |
| frame.appendChild(bottom); |
| + |
| + this.updateSharedStatus_(li, entry); |
| }; |
| /** |
| @@ -226,12 +229,9 @@ FileGrid.prototype.decorateThumbnail_ = function(li, entry) { |
| * |
| * @param {!HTMLDivElement} box Box to decorate. |
| * @param {Entry} entry Entry which thumbnail is generating for. |
| - * @param {function(HTMLImageElement)=} opt_imageLoadCallback Callback called |
|
fukino
2015/03/24 06:09:00
this opt_imageLoadCallback is removed because nobo
|
| - * when the image has been loaded before inserting it into the DOM. |
| * @private |
| */ |
| -FileGrid.prototype.decorateThumbnailBox_ = function( |
| - box, entry, opt_imageLoadCallback) { |
| +FileGrid.prototype.decorateThumbnailBox_ = function(box, entry) { |
| box.className = 'img-container'; |
| if (this.importStatusVisible_ && |
| @@ -245,12 +245,6 @@ FileGrid.prototype.decorateThumbnailBox_ = function( |
| if (entry.isDirectory) { |
| box.setAttribute('generic-thumbnail', 'folder'); |
| - |
| - var shared = !!this.metadataModel_.getCache([entry], ['shared'])[0].shared; |
| - box.classList.toggle('shared', shared); |
| - |
| - if (opt_imageLoadCallback) |
| - setTimeout(opt_imageLoadCallback, 0, null /* callback parameter */); |
| return; |
| } |
| @@ -268,6 +262,25 @@ FileGrid.prototype.decorateThumbnailBox_ = function( |
| }; |
| /** |
| + * Added 'shared' class to icon and placeholder of a folder item. |
| + * @param {!HTMLLIElement} li The grid item. |
| + * @param {!Entry} entry File entry for the grid item. |
| + * @private |
| + */ |
| +FileGrid.prototype.updateSharedStatus_ = function(li, entry) { |
| + if (!entry.isDirectory) |
| + return; |
| + |
| + var shared = !!this.metadataModel_.getCache([entry], ['shared'])[0].shared; |
| + var box = li.querySelector('.img-container'); |
| + if (box) |
| + box.classList.toggle('shared', shared); |
| + var icon = li.querySelector('.detail-icon'); |
| + if (icon) |
| + icon.classList.toggle('shared', shared); |
| +}; |
| + |
| +/** |
| * Sets the visibility of the cloud import status column. |
| * @param {boolean} visible |
| */ |