Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Unified Diff: ui/file_manager/file_manager/foreground/js/metadata_box_controller.js

Issue 2313763003: Show a local folder's size in QuickView. (Closed)
Patch Set: Show a local folder's size in QuickView. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/file_manager/file_manager/foreground/elements/files_metadata_entry.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
+};
« no previous file with comments | « ui/file_manager/file_manager/foreground/elements/files_metadata_entry.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698