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

Side by Side Diff: chrome/browser/resources/md_downloads/action_service.js

Issue 2284463002: MD Downloads: fix search spinner when terms are the same (Closed)
Patch Set: tsergeant@ review / test fix Created 4 years, 3 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/md_downloads/action_service_unittest.gtestjs » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('downloads', function() { 5 cr.define('downloads', function() {
6 /** 6 /**
7 * @param {string} chromeSendName 7 * @param {string} chromeSendName
8 * @return {function(string):void} A chrome.send() callback with curried name. 8 * @return {function(string):void} A chrome.send() callback with curried name.
9 */ 9 */
10 function chromeSendWithId(chromeSendName) { 10 function chromeSendWithId(chromeSendName) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 /** @param {string} id ID of the paused download to resume. */ 94 /** @param {string} id ID of the paused download to resume. */
95 resume: chromeSendWithId('resume'), 95 resume: chromeSendWithId('resume'),
96 96
97 /** 97 /**
98 * @param {string} id ID of the dangerous download to save despite 98 * @param {string} id ID of the dangerous download to save despite
99 * warnings. 99 * warnings.
100 */ 100 */
101 saveDangerous: chromeSendWithId('saveDangerous'), 101 saveDangerous: chromeSendWithId('saveDangerous'),
102 102
103 /** @param {string} searchText What to search for. */ 103 /**
104 * @param {string} searchText What to search for.
105 * @return {boolean} Whether |searchText| resulted in new search terms.
106 */
104 search: function(searchText) { 107 search: function(searchText) {
105 var searchTerms = ActionService.splitTerms(searchText); 108 var searchTerms = ActionService.splitTerms(searchText);
106 var sameTerms = searchTerms.length == this.searchTerms_.length; 109 var sameTerms = searchTerms.length == this.searchTerms_.length;
107 110
108 for (var i = 0; sameTerms && i < searchTerms.length; ++i) { 111 for (var i = 0; sameTerms && i < searchTerms.length; ++i) {
109 if (searchTerms[i] != this.searchTerms_[i]) 112 if (searchTerms[i] != this.searchTerms_[i])
110 sameTerms = false; 113 sameTerms = false;
111 } 114 }
112 115
113 if (sameTerms) 116 if (sameTerms)
114 return; 117 return false;
115 118
116 this.searchTerms_ = searchTerms; 119 this.searchTerms_ = searchTerms;
117 this.loadMore(); 120 this.loadMore();
121 return true;
118 }, 122 },
119 123
120 /** 124 /**
121 * Shows the local folder a finished download resides in. 125 * Shows the local folder a finished download resides in.
122 * @param {string} id ID of the download to show. 126 * @param {string} id ID of the download to show.
123 */ 127 */
124 show: chromeSendWithId('show'), 128 show: chromeSendWithId('show'),
125 129
126 /** Undo download removal. */ 130 /** Undo download removal. */
127 undo: chrome.send.bind(chrome, 'undo'), 131 undo: chrome.send.bind(chrome, 'undo'),
128 }; 132 };
129 133
130 cr.addSingletonGetter(ActionService); 134 cr.addSingletonGetter(ActionService);
131 135
132 return {ActionService: ActionService}; 136 return {ActionService: ActionService};
133 }); 137 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/md_downloads/action_service_unittest.gtestjs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698