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

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

Issue 1152433002: Gallery: Delete thumbnail cache when the item is deleted. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/gallery/js/gallery_data_model.js
diff --git a/ui/file_manager/gallery/js/gallery_data_model.js b/ui/file_manager/gallery/js/gallery_data_model.js
index b9921baa39190843975ff86ad86e6f040a78bbed..0d5d353e3512c98aa18ad514d6c8b381578053de 100644
--- a/ui/file_manager/gallery/js/gallery_data_model.js
+++ b/ui/file_manager/gallery/js/gallery_data_model.js
@@ -30,6 +30,8 @@ function GalleryDataModel(metadataModel, opt_watcher) {
// Start to watch file system entries.
var watcher = opt_watcher ? opt_watcher : new EntryListWatcher(this);
watcher.getEntry = function(item) { return item.getEntry(); };
+
+ this.addEventListener('splice', this.onSplice_.bind(this));
}
/**
@@ -152,3 +154,17 @@ GalleryDataModel.prototype.evictCache = function() {
}
}
};
+
+/**
+ * Handles entry delete.
+ * @param {!Event} event
+ * @private
+ */
+GalleryDataModel.prototype.onSplice_ = function(event) {
+ if (!event.removed || !event.removed.length)
+ return;
+ var removedURLs = event.removed.map(function(item) {
+ return item.getEntry().toURL();
+ });
+ this.metadataModel_.notifyEntriesRemoved(removedURLs);
+};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698