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

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: Fix error when searching from About page. 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 11cd9dd684eebba61b2ff7ec7ffed466e63f3575..34deca329b21adc1884e514c64f3ff1fa843ee6f 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 */
attached: function() {
document.addEventListener('toggle-advanced-page', function(e) {
this.showAdvancedPage_ = e.detail;
@@ -108,4 +109,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