| OLD | NEW |
| 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 this.$$('settings-advanced-page')); | 306 this.$$('settings-advanced-page')); |
| 307 } | 307 } |
| 308 if (settings.Route.BASIC.contains(route)) { | 308 if (settings.Route.BASIC.contains(route)) { |
| 309 return /** @type {?SettingsBasicPageElement} */( | 309 return /** @type {?SettingsBasicPageElement} */( |
| 310 this.$$('settings-basic-page')); | 310 this.$$('settings-basic-page')); |
| 311 } | 311 } |
| 312 assertNotReached(); | 312 assertNotReached(); |
| 313 }, | 313 }, |
| 314 | 314 |
| 315 /** | 315 /** |
| 316 * Navigates to the default search page (if necessary). | |
| 317 * @private | |
| 318 */ | |
| 319 ensureInDefaultSearchPage_: function() { | |
| 320 if (settings.getCurrentRoute() != settings.Route.BASIC) | |
| 321 settings.navigateTo(settings.Route.BASIC); | |
| 322 }, | |
| 323 | |
| 324 /** | |
| 325 * @param {string} query | 316 * @param {string} query |
| 326 * @return {!Promise} A promise indicating that searching finished. | 317 * @return {!Promise} A promise indicating that searching finished. |
| 327 */ | 318 */ |
| 328 searchContents: function(query) { | 319 searchContents: function(query) { |
| 329 // Trigger rendering of the basic and advanced pages and search once ready. | 320 // Trigger rendering of the basic and advanced pages and search once ready. |
| 330 this.inSearchMode_ = true; | 321 this.inSearchMode_ = true; |
| 331 this.ensureInDefaultSearchPage_(); | |
| 332 this.toolbarSpinnerActive = true; | 322 this.toolbarSpinnerActive = true; |
| 333 | 323 |
| 334 return new Promise(function(resolve, reject) { | 324 return new Promise(function(resolve, reject) { |
| 335 setTimeout(function() { | 325 setTimeout(function() { |
| 336 var whenSearchDone = settings.getSearchManager().search( | 326 var whenSearchDone = settings.getSearchManager().search( |
| 337 query, assert(this.getPage_(settings.Route.BASIC))); | 327 query, assert(this.getPage_(settings.Route.BASIC))); |
| 338 assert( | 328 assert( |
| 339 whenSearchDone === | 329 whenSearchDone === |
| 340 settings.getSearchManager().search( | 330 settings.getSearchManager().search( |
| 341 query, assert(this.getPage_(settings.Route.ADVANCED)))); | 331 query, assert(this.getPage_(settings.Route.ADVANCED)))); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 360 | 350 |
| 361 /** | 351 /** |
| 362 * @param {(boolean|undefined)} visibility | 352 * @param {(boolean|undefined)} visibility |
| 363 * @return {boolean} True unless visibility is false. | 353 * @return {boolean} True unless visibility is false. |
| 364 * @private | 354 * @private |
| 365 */ | 355 */ |
| 366 showAdvancedSettings_: function(visibility) { | 356 showAdvancedSettings_: function(visibility) { |
| 367 return visibility !== false; | 357 return visibility !== false; |
| 368 }, | 358 }, |
| 369 }); | 359 }); |
| OLD | NEW |