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

Unified Diff: chrome/browser/resources/settings/basic_page/basic_page.js

Issue 2739323005: MD Settings: Allow search within settings to track multiple requests separately. (Closed)
Patch Set: Address comments. Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/settings/search_settings.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/settings/basic_page/basic_page.js
diff --git a/chrome/browser/resources/settings/basic_page/basic_page.js b/chrome/browser/resources/settings/basic_page/basic_page.js
index 395996069a8aea4feb5bae7a690a8a48d2e43175..840b2f41d522cb3e4d3f20ea5a3c2d38bed3e24e 100644
--- a/chrome/browser/resources/settings/basic_page/basic_page.js
+++ b/chrome/browser/resources/settings/basic_page/basic_page.js
@@ -105,19 +105,31 @@ Polymer({
* Queues a task to search the basic sections, then another for the advanced
* sections.
* @param {string} query The text to search for.
- * @return {!Promise<!settings.SearchRequest>} A signal indicating that
+ * @return {!Promise<!settings.SearchResult>} A signal indicating that
* searching finished.
*/
searchContents: function(query) {
- var whenSearchDone = settings.getSearchManager().search(
- query, assert(this.$$('#basicPage')));
+ var whenSearchDone = [
+ settings.getSearchManager().search(query, assert(this.$$('#basicPage'))),
+ ];
if (this.pageVisibility.advancedSettings !== false) {
- assert(whenSearchDone === settings.getSearchManager().search(
+ whenSearchDone.push(settings.getSearchManager().search(
query, assert(this.$$('#advancedPageTemplate').get())));
}
- return whenSearchDone;
+ return Promise.all(whenSearchDone).then(function(requests) {
+ // Combine the SearchRequests results to a single SearchResult object.
+ return {
+ canceled: requests.some(function(r) { return r.canceled; }),
+ didFindMatches: requests.every(function(r) {
+ return !r.didFindMatches();
+ }),
+ // All requests correspond to the same user query, so only need to check
+ // one of them.
+ wasClearSearch: requests[0].isSame(''),
+ };
+ });
},
// <if expr="chromeos">
« no previous file with comments | « no previous file | chrome/browser/resources/settings/search_settings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698