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

Unified Diff: chrome/browser/resources/md_downloads/action_service.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: self-review 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/action_service.js
diff --git a/chrome/browser/resources/md_downloads/action_service.js b/chrome/browser/resources/md_downloads/action_service.js
index ee0a1b4a9fdc7384cfca8c7a120ddc7f6f18bf3b..e46350ce9faa468340ff02fa2eb45dc304c616bc 100644
--- a/chrome/browser/resources/md_downloads/action_service.js
+++ b/chrome/browser/resources/md_downloads/action_service.js
@@ -61,15 +61,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. */
@@ -101,12 +103,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_: '',
asanka 2015/12/07 20:31:50 Why do you keep this around?
asanka 2015/12/08 17:50:31 To clarity, I meant: "Isn't this redundant since w
Dan Beam 2015/12/09 06:55:21 Done.
/**
* Shows the local folder a finished download resides in.
« no previous file with comments | « no previous file | chrome/browser/resources/md_downloads/crisper.js » ('j') | chrome/browser/resources/md_downloads/manager.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698