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

Side by Side Diff: chrome/browser/resources/settings/settings_main/settings_main.js

Issue 2739323005: MD Settings: Allow search within settings to track multiple requests separately. (Closed)
Patch Set: Fix test error. 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
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 * @typedef {{about: boolean, settings: boolean}} 6 * @typedef {{about: boolean, settings: boolean}}
7 */ 7 */
8 var MainPageVisibility; 8 var MainPageVisibility;
9 9
10 /** 10 /**
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 */ 247 */
248 searchContents: function(query) { 248 searchContents: function(query) {
249 // Trigger rendering of the basic and advanced pages and search once ready. 249 // Trigger rendering of the basic and advanced pages and search once ready.
250 this.inSearchMode_ = true; 250 this.inSearchMode_ = true;
251 this.toolbarSpinnerActive = true; 251 this.toolbarSpinnerActive = true;
252 252
253 return new Promise(function(resolve, reject) { 253 return new Promise(function(resolve, reject) {
254 setTimeout(function() { 254 setTimeout(function() {
255 var whenSearchDone = 255 var whenSearchDone =
256 assert(this.getPage_(settings.Route.BASIC)).searchContents(query); 256 assert(this.getPage_(settings.Route.BASIC)).searchContents(query);
257 whenSearchDone.then(function(request) { 257 whenSearchDone.then(function(requests) {
258 resolve(); 258 resolve();
259 if (!request.finished) { 259 if (requests.some(function(r) { return r.canceled; })) {
Dan Beam 2017/03/14 00:44:28 can we hide these details in the request class?
dpapad 2017/03/14 03:28:11 Done. Wrapped those in a temp object inside basic_
260 // Nothing to do here. A previous search request was canceled 260 // Nothing to do here. A previous search request was canceled
261 // because a new search request was issued before the first one 261 // because a new search request was issued with a different query
262 // completed. 262 // before the previous completed.
263 return; 263 return;
264 } 264 }
265 265
266 this.toolbarSpinnerActive = false; 266 this.toolbarSpinnerActive = false;
267 this.inSearchMode_ = !request.isSame(''); 267 this.inSearchMode_ = !requests[0].isSame('');
Dan Beam 2017/03/14 00:44:27 should this also be .every()?
dpapad 2017/03/14 03:28:11 It does not need to, because all the requests corr
268 this.showNoResultsFound_ = 268 this.showNoResultsFound_ =
269 this.inSearchMode_ && !request.didFindMatches(); 269 this.inSearchMode_ &&
270 requests.every(function(r) { return !r.didFindMatches(); });
Dan Beam 2017/03/14 00:44:28 can we hide these details in the request class?
dpapad 2017/03/14 03:28:11 Done.
270 }.bind(this)); 271 }.bind(this));
271 }.bind(this), 0); 272 }.bind(this), 0);
272 }.bind(this)); 273 }.bind(this));
273 }, 274 },
274 }); 275 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698