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

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

Issue 371333002: Gallery.app: Update the ribbon control when the item is inserted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | « no previous file | ui/file_manager/gallery/js/ribbon.js » ('j') | ui/file_manager/gallery/js/ribbon.js » ('J')
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 b04bfa158bcd90cdcd4d648472fd60241dfb1155..67caf43afb4c9f60fb762fdddbb8bd702967eb1a 100644
--- a/ui/file_manager/gallery/js/gallery.js
+++ b/ui/file_manager/gallery/js/gallery.js
@@ -101,15 +101,15 @@ GalleryDataModel.prototype.saveItem = function(item, canvas, overwrite) {
// The item's entry is updated to the latest entry. Update metadata.
item.setMetadata(newMetadata);
- if (util.isSameEntry(oldEntry, item.getEntry())) {
- // Current entry is updated.
- // Dispatch an event.
- var event = new Event('content');
- event.item = item;
- event.oldEntry = item.getEntry();
- event.metadata = newMetadata;
- this.dispatchEvent(event);
+ // Current entry is updated.
+ // Dispatch an event.
+ var event = new Event('content');
+ event.item = item;
+ event.oldEntry = oldEntry;
+ event.metadata = newMetadata;
+ this.dispatchEvent(event);
+ if (util.isSameEntry(oldEntry, item.getEntry())) {
// Need an update of metdataCache.
this.metadataCache_.set(
item.getEntry(),
@@ -120,7 +120,11 @@ GalleryDataModel.prototype.saveItem = function(item, canvas, overwrite) {
// Add another item for the old entry.
var anotherItem = new Gallery.Item(
oldEntry, oldMetadata, this.metadataCache_);
- this.splice(this.indexOf(item), 0, anotherItem);
+ // The item must be added behind the existing item so that it does
+ // not change the index of the existing item.
+ // TODO(hirono): Update the item index of the selection model
+ // correctly.
+ this.splice(this.indexOf(item) + 1, 0, anotherItem);
}
fulfill();
« no previous file with comments | « no previous file | ui/file_manager/gallery/js/ribbon.js » ('j') | ui/file_manager/gallery/js/ribbon.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698