Commit 08f224a6 authored by hirono's avatar hirono Committed by Commit bot

Gallery: Delete thumbnail cache when the item is deleted.

BUG=489613
TEST=None

Review URL: https://codereview.chromium.org/1152433002

Cr-Commit-Position: refs/heads/master@{#330943}
parent c9cd43c8
......@@ -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 newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment