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

Unified Diff: ui/file_manager/gallery/js/ribbon.js

Issue 971173002: Gallery: Start to use new metadata model in Gallery. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Created 5 years, 10 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/gallery/js/mosaic_mode.js ('k') | ui/file_manager/gallery/js/slide_mode.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/gallery/js/ribbon.js
diff --git a/ui/file_manager/gallery/js/ribbon.js b/ui/file_manager/gallery/js/ribbon.js
index 5926a32f3eeffd63cde772fc6608cf5f46e444b9..e84dc0de7e970ea1f8fbf84fab11db08d49d8eac 100644
--- a/ui/file_manager/gallery/js/ribbon.js
+++ b/ui/file_manager/gallery/js/ribbon.js
@@ -8,33 +8,40 @@
* @param {!Document} document Document.
* @param {!cr.ui.ArrayDataModel} dataModel Data model.
* @param {!cr.ui.ListSelectionModel} selectionModel Selection model.
+ * @param {!ThumbnailModel} thumbnailModel
* @extends {HTMLDivElement}
* @constructor
* @suppress {checkStructDictInheritance}
* @struct
*/
-function Ribbon(document, dataModel, selectionModel) {
+function Ribbon(document, dataModel, selectionModel, thumbnailModel) {
if (this instanceof Ribbon) {
return Ribbon.call(/** @type {Ribbon} */ (document.createElement('div')),
- document, dataModel, selectionModel);
+ document, dataModel, selectionModel, thumbnailModel);
}
this.__proto__ = Ribbon.prototype;
this.className = 'ribbon';
/**
- * @type {!cr.ui.ArrayDataModel}
- * @private
+ * @private {!cr.ui.ArrayDataModel}
+ * @const
*/
this.dataModel_ = dataModel;
/**
- * @type {!cr.ui.ListSelectionModel}
- * @private
+ * @private {!cr.ui.ListSelectionModel}
+ * @const
*/
this.selectionModel_ = selectionModel;
/**
+ * @private {!ThumbnailModel}
+ * @const
+ */
+ this.thumbnailModel_ = thumbnailModel;
+
+ /**
* @type {!Object}
* @private
*/
@@ -389,14 +396,16 @@ Ribbon.prototype.renderThumbnail_ = function(index) {
* @private
*/
Ribbon.prototype.setThumbnailImage_ = function(thumbnail, item) {
- var loader = new ThumbnailLoader(
- item.getEntry(),
- ThumbnailLoader.LoaderType.IMAGE,
- item.getMetadata());
- loader.load(
- thumbnail.querySelector('.image-wrapper'),
- ThumbnailLoader.FillMode.FILL /* fill */,
- ThumbnailLoader.OptimizationMode.NEVER_DISCARD);
+ this.thumbnailModel_.get([item.getEntry()]).then(function(metadataList) {
+ var loader = new ThumbnailLoader(
+ item.getEntry(),
+ ThumbnailLoader.LoaderType.IMAGE,
+ metadataList[0]);
+ loader.load(
+ thumbnail.querySelector('.image-wrapper'),
+ ThumbnailLoader.FillMode.FILL /* fill */,
+ ThumbnailLoader.OptimizationMode.NEVER_DISCARD);
+ });
};
/**
« no previous file with comments | « ui/file_manager/gallery/js/mosaic_mode.js ('k') | ui/file_manager/gallery/js/slide_mode.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698