Chromium Code Reviews| Index: chrome/browser/resources/settings/settings_main/settings_main.js |
| diff --git a/chrome/browser/resources/settings/settings_main/settings_main.js b/chrome/browser/resources/settings/settings_main/settings_main.js |
| index f9afe10053f9bbe4649a97a3c3b9115cdebe440d..59092cb83d4abe2d01739476076c6cb114bd5e39 100644 |
| --- a/chrome/browser/resources/settings/settings_main/settings_main.js |
| +++ b/chrome/browser/resources/settings/settings_main/settings_main.js |
| @@ -59,6 +59,7 @@ Polymer({ |
| }, |
| }, |
| + /** @override */ |
| created: function() { |
| /** @private {!PromiseResolver} */ |
| this.resolver_ = new PromiseResolver; |
| @@ -124,4 +125,36 @@ Polymer({ |
| toggleAdvancedPage_: function() { |
| this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_); |
| }, |
| + |
| + /** |
| + * Navigates to the default search page (if necessary). |
| + * @private |
| + */ |
| + ensureInDefaultSearchPage_: function() { |
| + if (this.currentRoute.page != 'basic' || |
| + this.currentRoute.section != '' || |
| + this.currentRoute.subpage.length != 0) { |
| + this.currentRoute = {page: 'basic', section: '', subpage: [], url: ''}; |
|
Dan Beam
2016/07/01 21:32:35
nit: can you just omit the URL? and maybe add a ro
dpapad
2016/07/01 21:59:42
The 'url' field is needed only for the Compiler. I
Dan Beam
2016/07/01 22:41:01
fun fact: it's only required if you:
a) depend set
Dan Beam
2016/07/01 22:48:27
or dschuyler@'s CL that makes url: (string|undefin
|
| + } |
| + }, |
| + |
| + /** |
| + * @param {string} query |
| + */ |
| + searchContents: function(query) { |
| + this.ensureInDefaultSearchPage_(); |
| + |
| + // Trigger rendering of the basic and advanced pages and search once ready. |
| + // Even if those are already rendered, yield to the message loop before |
| + // initiating searching. |
| + this.showBasicPage_ = true; |
| + setTimeout(function() { |
| + settings.search(query, assert(this.$$('settings-basic-page'))); |
| + }.bind(this), 0); |
| + |
| + this.showAdvancedPage_ = true; |
| + setTimeout(function() { |
| + settings.search(query, assert(this.$$('settings-advanced-page'))); |
| + }.bind(this), 0); |
| + }, |
| }); |