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); |
+ }); |
}; |
/** |