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

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

Issue 2507873002: MD Settings search code will not assume the Advanced section exists. (Closed)
Patch Set: Use this.pageVisibility.advancedSettings Created 4 years, 1 month 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 | no next file » | 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 * @typedef {{about: boolean, basic: boolean, advanced: boolean}} 6 * @typedef {{about: boolean, basic: boolean, advanced: boolean}}
7 */ 7 */
8 var MainPageVisibility; 8 var MainPageVisibility;
9 9
10 /** 10 /**
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 */ 323 */
324 searchContents: function(query) { 324 searchContents: function(query) {
325 // Trigger rendering of the basic and advanced pages and search once ready. 325 // Trigger rendering of the basic and advanced pages and search once ready.
326 this.inSearchMode_ = true; 326 this.inSearchMode_ = true;
327 this.toolbarSpinnerActive = true; 327 this.toolbarSpinnerActive = true;
328 328
329 return new Promise(function(resolve, reject) { 329 return new Promise(function(resolve, reject) {
330 setTimeout(function() { 330 setTimeout(function() {
331 var whenSearchDone = settings.getSearchManager().search( 331 var whenSearchDone = settings.getSearchManager().search(
332 query, assert(this.getPage_(settings.Route.BASIC))); 332 query, assert(this.getPage_(settings.Route.BASIC)));
333 assert( 333
334 whenSearchDone === 334 if (this.pageVisibility.advancedSettings !== false) {
335 settings.getSearchManager().search( 335 assert(whenSearchDone === settings.getSearchManager().search(
336 query, assert(this.getPage_(settings.Route.ADVANCED)))); 336 query, assert(this.getPage_(settings.Route.ADVANCED))));
337 }
337 338
338 whenSearchDone.then(function(request) { 339 whenSearchDone.then(function(request) {
339 resolve(); 340 resolve();
340 if (!request.finished) { 341 if (!request.finished) {
341 // Nothing to do here. A previous search request was canceled 342 // Nothing to do here. A previous search request was canceled
342 // because a new search request was issued before the first one 343 // because a new search request was issued before the first one
343 // completed. 344 // completed.
344 return; 345 return;
345 } 346 }
346 347
347 this.toolbarSpinnerActive = false; 348 this.toolbarSpinnerActive = false;
348 this.inSearchMode_ = !request.isSame(''); 349 this.inSearchMode_ = !request.isSame('');
349 this.showNoResultsFound_ = 350 this.showNoResultsFound_ =
350 this.inSearchMode_ && !request.didFindMatches(); 351 this.inSearchMode_ && !request.didFindMatches();
351 }.bind(this)); 352 }.bind(this));
352 }.bind(this), 0); 353 }.bind(this), 0);
353 }.bind(this)); 354 }.bind(this));
354 }, 355 },
355 356
356 /** 357 /**
357 * @param {(boolean|undefined)} visibility 358 * @param {(boolean|undefined)} visibility
358 * @return {boolean} True unless visibility is false. 359 * @return {boolean} True unless visibility is false.
359 * @private 360 * @private
360 */ 361 */
361 showAdvancedSettings_: function(visibility) { 362 showAdvancedSettings_: function(visibility) {
362 return visibility !== false; 363 return visibility !== false;
363 }, 364 },
364 }); 365 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698