Chromium Code Reviews| Index: ui/file_manager/file_manager/foreground/js/metadata_box_controller.js |
| diff --git a/ui/file_manager/file_manager/foreground/js/metadata_box_controller.js b/ui/file_manager/file_manager/foreground/js/metadata_box_controller.js |
| index 94d8bc8b21446b735103a799aa671dc65d4788bd..9a10a5308f55a52d5657c3c9aa1bf638b23e870c 100644 |
| --- a/ui/file_manager/file_manager/foreground/js/metadata_box_controller.js |
| +++ b/ui/file_manager/file_manager/foreground/js/metadata_box_controller.js |
| @@ -90,7 +90,7 @@ MetadataBoxController.prototype.updateView_ = function() { |
| * Update metadata box with general file information. |
| * Then retrieve file specific metadata if any. |
| * |
| - * @param {!FileEntry} entry |
| + * @param {!Entry} entry |
| * @param {!Array<!MetadataItem>} items |
| * |
| * @private |
| @@ -105,6 +105,9 @@ MetadataBoxController.prototype.onGeneralMetadataLoaded_ = function( |
| this.metadataBox_.size = |
| this.fileMetadataFormatter_.formatSize(item.size, item.hosted); |
| } |
| + if (entry.isDirectory) { |
| + this.setDirectorySize_( /** @type {!DirectoryEntry} */ (entry)); |
| + } |
| if (item.modificationTime) { |
| this.metadataBox_.modificationTime = |
| this.fileMetadataFormatter_.formatModDate(item.modificationTime); |
| @@ -147,3 +150,31 @@ MetadataBoxController.prototype.onGeneralMetadataLoaded_ = function( |
| } |
| } |
| }; |
| + |
| +/** |
| + * Set a current directory's size in metadata box. |
| + * |
| + * @param {!DirectoryEntry} entry |
| + * |
| + * @private |
| + */ |
| +MetadataBoxController.prototype.setDirectorySize_ = function(entry) { |
| + if (!entry.isDirectory) |
| + return; |
| + |
| + this.metadataBox_.isSizeLoading = true; |
| + chrome.fileManagerPrivate.getDirectorySize(entry, |
| + function(size) { |
| + if(this.quickViewModel_.getSelectedEntry() != entry) { |
| + return; |
| + } |
| + if(chrome.runtime.lastError) { |
| + this.metadataBox_.isSizeLoading = false; |
| + return; |
| + } |
| + |
| + this.metadataBox_.isSizeLoading = false; |
| + this.metadataBox_.size = |
| + this.fileMetadataFormatter_.formatSize(size, true); |
| + }.bind(this)); |
|
fukino
2016/09/06 11:30:58
indent level should be same as function(size)
|
| +}; |