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

Unified Diff: ui/file_manager/gallery/js/gallery_item.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: Rebased. 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/gallery_item.js
diff --git a/ui/file_manager/gallery/js/gallery_item.js b/ui/file_manager/gallery/js/gallery_item.js
index 6d87f3ea692973a0fe5d86e704513e2a04707b0c..65641ebf176c9119b9a4f8de7067b60a551f2daa 100644
--- a/ui/file_manager/gallery/js/gallery_item.js
+++ b/ui/file_manager/gallery/js/gallery_item.js
@@ -8,6 +8,7 @@
* @param {!FileEntry} entry Image entry.
* @param {!EntryLocation} locationInfo Entry location information.
* @param {!Object} metadata Metadata for the entry.
+ * @param {!MetadataItem} metadataItem
* @param {!MetadataCache} metadataCache Metadata cache instance.
* @param {!MetadataModel} metadataModel File system metadata.
* @param {boolean} original Whether the entry is original or edited.
@@ -15,8 +16,8 @@
* @struct
*/
Gallery.Item = function(
- entry, locationInfo, metadata, metadataCache, metadataModel,
- original) {
+ entry, locationInfo, metadata, metadataItem, metadataCache,
+ metadataModel, original) {
/**
* @type {!FileEntry}
* @private
@@ -36,6 +37,11 @@ Gallery.Item = function(
this.metadata_ = Object.preventExtensions(metadata);
/**
+ * @type {!MetadataItem}
+ */
+ this.metadataItem_ = metadataItem;
+
+ /**
* @type {!MetadataCache}
* @private
* @const
@@ -100,24 +106,10 @@ Gallery.Item.prototype.getLocationInfo = function() {
Gallery.Item.prototype.getMetadata = function() { return this.metadata_; };
/**
- * Obtains the latest media metadata.
- *
- * This is a heavy operation since it forces to load the image data to obtain
- * the metadata.
- * @return {!Promise} Promise to be fulfilled with fetched metadata.
+ * @return {!MetadataItem} Metadata.
*/
-Gallery.Item.prototype.getFetchedMedia = function() {
- return new Promise(function(fulfill, reject) {
- this.metadataCache_.getLatest(
- [this.entry_],
- 'fetchedMedia',
- function(metadata) {
- if (metadata[0])
- fulfill(metadata[0]);
- else
- reject('Failed to load metadata.');
- });
- }.bind(this));
+Gallery.Item.prototype.getMetadataItem = function() {
+ return this.metadataItem_;
};
/**

Powered by Google App Engine
This is Rietveld 408576698