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

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: Address comments. Created 4 years, 5 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 254f2614a20cbdb195c39564ef9c5b7137b97d2e..75daea44da83eb7a5e91e6f11fb9a2c469abc85b 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;
@@ -129,4 +130,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: ''};
+ }
+ },
+
+ /**
+ * @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