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

Unified Diff: ui/file_manager/gallery/js/image_editor/image_util.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
Index: ui/file_manager/gallery/js/image_editor/image_util.js
diff --git a/ui/file_manager/gallery/js/image_editor/image_util.js b/ui/file_manager/gallery/js/image_editor/image_util.js
index 83f4d63261d937c727007ff22e4b0e1fdbe31424..76481b5021430c14e5f400fdea52641ae09ab499 100644
--- a/ui/file_manager/gallery/js/image_editor/image_util.js
+++ b/ui/file_manager/gallery/js/image_editor/image_util.js
@@ -427,11 +427,19 @@ ImageUtil.setClass = function(element, className, on) {
* account.
*
* @param {!HTMLDocument} document Owner document.
+ * @param {!MetadataModel} metadataModel
* @constructor
* @struct
*/
-ImageUtil.ImageLoader = function(document) {
+ImageUtil.ImageLoader = function(document, metadataModel) {
this.document_ = document;
+
+ /**
+ * @private {!MetadataModel}
+ * @const
+ */
+ this.metadataModel_ = metadataModel;
+
this.image_ = new Image();
this.generation_ = 0;
@@ -510,14 +518,10 @@ ImageUtil.ImageLoader.prototype.load = function(item, callback, opt_delay) {
this.image_.onload = function() {
this.image_.onerror = null;
this.image_.onload = null;
- item.getFetchedMedia().then(function(fetchedMediaMetadata) {
- if (fetchedMediaMetadata.imageTransform)
- onTransform(this.image_, fetchedMediaMetadata.imageTransform);
- else
- onTransform(this.image_);
- }.bind(this)).catch(function(error) {
- console.error(error.stack || error);
- });
+ this.metadataModel_.get([entry], ['contentImageTransform']).then(
+ function(metadataItems) {
+ onTransform(this.image_, metadataItems[0].contentImageTransform);
+ }.bind(this));
}.bind(this);
// The error callback has an optional error argument, which in case of a
« no previous file with comments | « ui/file_manager/gallery/js/gallery_item_unittest.js ('k') | ui/file_manager/gallery/js/image_editor/image_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698