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..6d0b286dc4e652f2a734f3e9248d3b017b438932 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)); |
+}; |