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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/settings/search_settings.js » ('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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * 'settings-basic-page' is the settings page containing the actual settings. 7 * 'settings-basic-page' is the settings page containing the actual settings.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-basic-page', 10 is: 'settings-basic-page',
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 assert(!this.hasExpandedSection_); 98 assert(!this.hasExpandedSection_);
99 } 99 }
100 100
101 MainPageBehaviorImpl.currentRouteChanged.call(this, newRoute, oldRoute); 101 MainPageBehaviorImpl.currentRouteChanged.call(this, newRoute, oldRoute);
102 }, 102 },
103 103
104 /** 104 /**
105 * Queues a task to search the basic sections, then another for the advanced 105 * Queues a task to search the basic sections, then another for the advanced
106 * sections. 106 * sections.
107 * @param {string} query The text to search for. 107 * @param {string} query The text to search for.
108 * @return {!Promise<!settings.SearchRequest>} A signal indicating that 108 * @return {!Promise<!settings.SearchResult>} A signal indicating that
109 * searching finished. 109 * searching finished.
110 */ 110 */
111 searchContents: function(query) { 111 searchContents: function(query) {
112 var whenSearchDone = settings.getSearchManager().search( 112 var whenSearchDone = [
113 query, assert(this.$$('#basicPage'))); 113 settings.getSearchManager().search(query, assert(this.$$('#basicPage'))),
114 ];
114 115
115 if (this.pageVisibility.advancedSettings !== false) { 116 if (this.pageVisibility.advancedSettings !== false) {
116 assert(whenSearchDone === settings.getSearchManager().search( 117 whenSearchDone.push(settings.getSearchManager().search(
117 query, assert(this.$$('#advancedPageTemplate').get()))); 118 query, assert(this.$$('#advancedPageTemplate').get())));
118 } 119 }
119 120
120 return whenSearchDone; 121 return Promise.all(whenSearchDone).then(function(requests) {
122 // Combine the SearchRequests results to a single SearchResult object.
123 return {
124 canceled: requests.some(function(r) { return r.canceled; }),
125 didFindMatches: requests.every(function(r) {
126 return !r.didFindMatches();
127 }),
128 // All requests correspond to the same user query, so only need to check
129 // one of them.
130 wasClearSearch: requests[0].isSame(''),
131 };
132 });
121 }, 133 },
122 134
123 // <if expr="chromeos"> 135 // <if expr="chromeos">
124 /** 136 /**
125 * @return {boolean} 137 * @return {boolean}
126 * @private 138 * @private
127 */ 139 */
128 computeShowSecondaryUserBanner_: function() { 140 computeShowSecondaryUserBanner_: function() {
129 return !this.hasExpandedSection_ && 141 return !this.hasExpandedSection_ &&
130 loadTimeData.getBoolean('isSecondaryUser'); 142 loadTimeData.getBoolean('isSecondaryUser');
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 227
216 /** 228 /**
217 * @param {boolean} opened Whether the menu is expanded. 229 * @param {boolean} opened Whether the menu is expanded.
218 * @return {string} Icon name. 230 * @return {string} Icon name.
219 * @private 231 * @private
220 */ 232 */
221 getArrowIcon_: function(opened) { 233 getArrowIcon_: function(opened) {
222 return opened ? 'cr:arrow-drop-up' : 'cr:arrow-drop-down'; 234 return opened ? 'cr:arrow-drop-up' : 'cr:arrow-drop-down';
223 }, 235 },
224 }); 236 });
OLDNEW
« 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