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

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

Issue 2060983003: Quick View: Add functinoality to show generic metadata (size and modificationTime). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 6 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
Index: ui/file_manager/file_manager/foreground/js/quick_view_controller.js
diff --git a/ui/file_manager/file_manager/foreground/js/quick_view_controller.js b/ui/file_manager/file_manager/foreground/js/quick_view_controller.js
index acc574f0fc6d6d87086158cd58149dbb37f87601..c18e031886b50d182bd8953de86a7379cf359278 100644
--- a/ui/file_manager/file_manager/foreground/js/quick_view_controller.js
+++ b/ui/file_manager/file_manager/foreground/js/quick_view_controller.js
@@ -9,11 +9,12 @@
* @param {!MetadataModel} metadataModel File system metadata.
* @param {!FileSelectionHandler} selectionHandler
* @param {!ListContainer} listContainer
+ * @param {!QuickViewModel} quickViewModel
*
* @constructor
*/
function QuickViewController(
- quickView, metadataModel, selectionHandler, listContainer) {
+ quickView, metadataModel, selectionHandler, listContainer, quickViewModel) {
/**
* @type {!FilesQuickView}
* @private
@@ -21,12 +22,10 @@ function QuickViewController(
this.quickView_ = quickView;
/**
- * Selected entries.
- *
- * @type {!Array<FileEntry>}
+ * @type{!QuickViewModel}
* @private
*/
- this.entries_ = [];
+ this.quickViewModel_ = quickViewModel;
/**
* @type {!MetadataModel}
@@ -40,6 +39,14 @@ function QuickViewController(
*/
this.listContainer_ = listContainer;
+ /**
+ * Current selection of selectionHandler.
+ *
+ * @type {!Array<!FileEntry>}
+ * @private
+ */
+ this.entries_ = [];
+
selectionHandler.addEventListener(
FileSelectionHandler.EventType.CHANGE,
this.onFileSelectionChanged_.bind(this));
@@ -94,12 +101,15 @@ QuickViewController.prototype.display_ = function() {
/**
* Update quick view on file selection change.
*
+ * @param {!Event} event an Event whose target is FileSelectionHandler.
* @private
*/
QuickViewController.prototype.onFileSelectionChanged_ = function(event) {
this.entries_ = event.target.selection.entries;
if (this.quickView_.isOpened()) {
assert(this.entries_.length > 0);
+ var entry = this.entries_[0];
+ this.quickViewModel_.setSelectedEntry(entry);
this.display_();
}
};
@@ -113,8 +123,11 @@ QuickViewController.prototype.onFileSelectionChanged_ = function(event) {
QuickViewController.prototype.updateQuickView_ = function() {
assert(this.entries_.length > 0);
// TODO(oka): Support multi-selection.
+ this.quickViewModel_.setSelectedEntry(this.entries_[0]);
- var entry = (/** @type {!FileEntry} */ (this.entries_[0]));
+ var entry =
+ (/** @type {!FileEntry} */ (this.quickViewModel_.getSelectedEntry()));
+ assert(entry);
return this.metadataModel_.get([entry], ['contentThumbnailUrl'])
.then(this.onMetadataLoaded_.bind(this, entry));
};

Powered by Google App Engine
This is Rietveld 408576698