| Index: ui/file_manager/file_manager/foreground/js/list_thumbnail_loader.js
|
| diff --git a/ui/file_manager/file_manager/foreground/js/list_thumbnail_loader.js b/ui/file_manager/file_manager/foreground/js/list_thumbnail_loader.js
|
| index ba73fa46bbadce0436fb4014c69ffc3e9dad3e76..8c6b44a46489e849b1eb500e2f1bba7ea35a9610 100644
|
| --- a/ui/file_manager/file_manager/foreground/js/list_thumbnail_loader.js
|
| +++ b/ui/file_manager/file_manager/foreground/js/list_thumbnail_loader.js
|
| @@ -10,16 +10,6 @@
|
| * is responsible to return dataUrls of valid thumbnails and fetch them with
|
| * proper priority.
|
| *
|
| - * TODOs
|
| - * The following list is a todo list for this class. This list will be deleted
|
| - * after all of them are implemented.
|
| - * * Done: Fetch thumbnails with range based priority control.
|
| - * * Done: Implement cache size limitation.
|
| - * * Done: Modest queueing for low priority thumbnail fetches.
|
| - * * Handle other event types of FileListModel, e.g. sort.
|
| - * * Done: Change ThumbnailLoader to directly return dataUrl.
|
| - * * Handle file types for which generic images are used.
|
| - *
|
| * @param {!FileListModel} dataModel A file list model.
|
| * @param {!MetadataCache} metadataCache Metadata cache.
|
| * @param {!Document} document Document.
|
| @@ -89,8 +79,10 @@ function ListThumbnailLoader(
|
| */
|
| this.cursor_ = 0;
|
|
|
| - // TODO(yawano): Handle other event types of FileListModel, e.g. sort.
|
| + // TODO(yawano): Change FileListModel to dispatch change event for file
|
| + // change, and change this class to handle it.
|
| this.dataModel_.addEventListener('splice', this.onSplice_.bind(this));
|
| + this.dataModel_.addEventListener('sorted', this.onSorted_.bind(this));
|
| }
|
|
|
| ListThumbnailLoader.prototype.__proto__ = cr.EventTarget.prototype;
|
| @@ -126,6 +118,17 @@ ListThumbnailLoader.prototype.onSplice_ = function(event) {
|
| }
|
|
|
| /**
|
| + * An event handler for sorted event of data model. When list is sorted, start
|
| + * to rescan items.
|
| + *
|
| + * @param {!Event} event Event
|
| + */
|
| +ListThumbnailLoader.prototype.onSorted_ = function(event) {
|
| + this.cursor_ = this.beginIndex_;
|
| + this.continue_();
|
| +}
|
| +
|
| +/**
|
| * Sets high priority range in the list.
|
| *
|
| * @param {number} beginIndex Begin index of the range, inclusive.
|
|
|