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

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

Issue 802283005: Gallery: Update metadata in GalleryItem when saving items. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « chrome/browser/chromeos/file_manager/gallery_jstest.cc ('k') | ui/file_manager/gallery/js/gallery_item.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/gallery/js/gallery.js
diff --git a/ui/file_manager/gallery/js/gallery.js b/ui/file_manager/gallery/js/gallery.js
index a575e86771e9a9fad5749943b071ce2c279a8463..b0a12ceb538121c208091ee9739700aaaaf1e488 100644
--- a/ui/file_manager/gallery/js/gallery.js
+++ b/ui/file_manager/gallery/js/gallery.js
@@ -71,47 +71,27 @@ GalleryDataModel.prototype.saveItem = function(
var oldEntry = item.getEntry();
var oldMetadata = item.getMetadata();
var oldLocationInfo = item.getLocationInfo();
- var metadataEncoder = ImageEncoder.encodeMetadata(
- item.getMetadata(), canvas, 1 /* quality */);
- var newMetadata = ContentProvider.ConvertContentMetadata(
- metadataEncoder.getMetadata(),
- MetadataCache.cloneMetadata(item.getMetadata()));
- if (newMetadata.filesystem)
- newMetadata.filesystem.modificationTime = new Date();
- if (newMetadata.external)
- newMetadata.external.present = true;
-
return new Promise(function(fulfill, reject) {
item.saveToFile(
volumeManager,
this.fallbackSaveDirectory,
overwrite,
canvas,
- metadataEncoder,
function(success) {
if (!success) {
reject('Failed to save the image.');
return;
}
- // The item's entry is updated to the latest entry. Update metadata.
- item.setMetadata(newMetadata);
-
// Current entry is updated.
// Dispatch an event.
var event = new Event('content');
event.item = item;
event.oldEntry = oldEntry;
- event.metadata = newMetadata;
+ event.metadata = item.getMetadata();
this.dispatchEvent(event);
- if (util.isSameEntry(oldEntry, item.getEntry())) {
- // Need an update of metdataCache.
- this.metadataCache_.set(
- item.getEntry(),
- Gallery.METADATA_TYPE,
- newMetadata);
- } else {
+ if (!util.isSameEntry(oldEntry, item.getEntry())) {
// New entry is added and the item now tracks it.
// Add another item for the old entry.
var anotherItem = new Gallery.Item(
« no previous file with comments | « chrome/browser/chromeos/file_manager/gallery_jstest.cc ('k') | ui/file_manager/gallery/js/gallery_item.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698