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

Unified Diff: chrome/browser/resources/md_downloads/manager.js

Issue 1492273002: MD Downloads: limit the amount of downloads we send (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new-dl-data
Patch Set: asdf Created 5 years 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
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..086567524c9865eefc78213f5d2eb0e860fa5ce6 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,25 @@ cr.define('downloads', function() {
downloads.ActionService.getInstance().undo();
},
+ /**
+ * @param {Event} e
+ * @private
+ */
+ onListScroll_: function(e) {
+ var list = this.$['downloads-list'];
+ if (list.scrollHeight - list.scrollTop - list.offsetHeight <= 100) {
+ // Approaching 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();
},
/**
@@ -106,6 +121,7 @@ cr.define('downloads', function() {
removeItem_: function(index) {
this.splice('items_', index, 1);
this.updateHideDates_(index, index);
+ this.onListScroll_();
},
/**

Powered by Google App Engine
This is Rietveld 408576698