| 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..f984fe5a14614e3b853993e4dcaad33b70577641 100644
|
| --- a/chrome/browser/resources/md_downloads/action_service.js
|
| +++ b/chrome/browser/resources/md_downloads/action_service.js
|
| @@ -13,27 +13,6 @@
|
|
|
| /** @constructor */
|
| function ActionService() {}
|
| -
|
| - /**
|
| - * @param {string} s
|
| - * @return {string} |s| without whitespace at the beginning or end.
|
| - */
|
| - function trim(s) { return s.trim(); }
|
| -
|
| - /**
|
| - * @param {string|undefined} value
|
| - * @return {boolean} Whether |value| is truthy.
|
| - */
|
| - function truthy(value) { return !!value; }
|
| -
|
| - /**
|
| - * @param {string} searchText Input typed by the user into a search box.
|
| - * @return {Array<string>} A list of terms extracted from |searchText|.
|
| - */
|
| - ActionService.splitTerms = function(searchText) {
|
| - // Split quoted terms (e.g., 'The "lazy" dog' => ['The', 'lazy', 'dog']).
|
| - return searchText.split(/"([^"]*)"/).map(trim).filter(truthy);
|
| - };
|
|
|
| ActionService.prototype = {
|
| /** @param {string} id ID of the download to cancel. */
|
| @@ -61,15 +40,12 @@
|
| /** @param {string} id ID of the download that the user started dragging. */
|
| drag: chromeSendWithId('drag'),
|
|
|
| - /** @private {boolean} */
|
| - isSearching_: false,
|
| -
|
| /**
|
| * @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.searchText_.length > 0;
|
| },
|
|
|
| /** Opens the current local destination for downloads. */
|
| @@ -102,10 +78,9 @@
|
|
|
| this.searchText_ = searchText;
|
|
|
| - var terms = ActionService.splitTerms(searchText);
|
| - this.isSearching_ = terms.length > 0;
|
| -
|
| - chrome.send('getDownloads', terms);
|
| + // Split quoted terms (e.g., 'The "lazy" dog' => ['The', 'lazy', 'dog']).
|
| + function trim(s) { return s.trim(); }
|
| + chrome.send('getDownloads', searchText.split(/"([^"]*)"/).map(trim));
|
| },
|
|
|
| /**
|
|
|