| Index: chrome/browser/resources/md_downloads/crisper.js
|
| diff --git a/chrome/browser/resources/md_downloads/crisper.js b/chrome/browser/resources/md_downloads/crisper.js
|
| index ee13e9ccc5999ff5cc0467850c70ed2c6112fb24..15a1848f29225c7d757b89e221ee6d5adb1949bd 100644
|
| --- a/chrome/browser/resources/md_downloads/crisper.js
|
| +++ b/chrome/browser/resources/md_downloads/crisper.js
|
| @@ -1578,15 +1578,17 @@ cr.define('downloads', function() {
|
| /** @param {string} id ID of the download that the user started dragging. */
|
| drag: chromeSendWithId('drag'),
|
|
|
| - /** @private {boolean} */
|
| - isSearching_: false,
|
| + /** Loads more downloads with the current search terms. */
|
| + loadMore: function() {
|
| + chrome.send('getDownloads', this.searchTerms_);
|
| + },
|
|
|
| /**
|
| * @return {boolean} Whether the user is currently searching for downloads
|
| * (i.e. has a non-empty search term).
|
| */
|
| isSearching: function() {
|
| - return this.isSearching_;
|
| + return this.searchTerms_.length > 0;
|
| },
|
|
|
| /** Opens the current local destination for downloads. */
|
| @@ -1618,12 +1620,15 @@ cr.define('downloads', function() {
|
| return;
|
|
|
| this.searchText_ = searchText;
|
| + this.searchTerms_ = ActionService.splitTerms(this.searchText_);
|
| + this.loadMore();
|
| + },
|
|
|
| - var terms = ActionService.splitTerms(searchText);
|
| - this.isSearching_ = terms.length > 0;
|
| + /** @private {Array<string>} */
|
| + searchTerms_: [],
|
|
|
| - chrome.send('getDownloads', terms);
|
| - },
|
| + /** @private {string} */
|
| + searchText_: '',
|
|
|
| /**
|
| * Shows the local folder a finished download resides in.
|
| @@ -16976,6 +16981,10 @@ cr.define('downloads', function() {
|
| loading: true,
|
| },
|
|
|
| + listeners: {
|
| + 'downloads-list.scroll': 'onListScroll_',
|
| + },
|
| +
|
| observers: [
|
| 'itemsChanged_(items_.*)',
|
| ],
|
| @@ -17043,14 +17052,26 @@ cr.define('downloads', function() {
|
| downloads.ActionService.getInstance().undo();
|
| },
|
|
|
| + /**
|
| + * @param {Event} e
|
| + * @private
|
| + */
|
| + onListScroll_: function(e) {
|
| + var list = this.$['downloads-list'];
|
| + if (list.scrollHeight > list.offsetHeight &&
|
| + list.scrollTop + list.offsetHeight == list.scrollHeight) {
|
| + // Reached the end of the scrollback. Attempt to load more items.
|
| + downloads.ActionService.getInstance().loadMore();
|
| + }
|
| + },
|
| +
|
| /** @private */
|
| onLoad_: function() {
|
| cr.ui.decorate('command', cr.ui.Command);
|
| document.addEventListener('canExecute', this.onCanExecute_.bind(this));
|
| document.addEventListener('command', this.onCommand_.bind(this));
|
|
|
| - // Shows all downloads.
|
| - downloads.ActionService.getInstance().search('');
|
| + downloads.ActionService.getInstance().loadMore();
|
| },
|
|
|
| /**
|
|
|