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

Unified Diff: chrome/browser/resources/settings/settings_main/settings_main.js

Issue 2082793003: MD Settings: First iteration of searching within settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cr_search_migration0
Patch Set: Use deep Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
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);
+ },
});

Powered by Google App Engine
This is Rietveld 408576698