Chromium Code Reviews| Index: chrome/browser/resources/md_downloads/manager.js |
| diff --git a/chrome/browser/resources/md_downloads/manager.js b/chrome/browser/resources/md_downloads/manager.js |
| index 91faf6a1b79d08f3c5aac0e36f91656190a8bf12..cd57fad4fb61d303bad0ebee0bc1585329f469ce 100644 |
| --- a/chrome/browser/resources/md_downloads/manager.js |
| +++ b/chrome/browser/resources/md_downloads/manager.js |
| @@ -22,6 +22,10 @@ cr.define('downloads', function() { |
| loading: true, |
| }, |
| + listeners: { |
| + 'downloads-list.scroll': 'onListScroll_', |
| + }, |
| + |
| observers: [ |
| 'itemsChanged_(items_.*)', |
| ], |
| @@ -89,14 +93,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 && |
|
asanka
2015/12/07 20:31:50
Imma n00b. Shouldn't this be list.scrollHeight > l
Dan Beam
2015/12/09 06:55:21
https://drafts.csswg.org/cssom-view/#dom-htmleleme
|
| + 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(); |
| }, |
| /** |