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

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

Issue 2350313003: MD Settings: Ensure all search results are visible when going back. (Closed)
Patch Set: Fix Created 4 years, 3 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 8123ced1a9d8e218a77f943d882191aef4e8057e..d43bfeff5db81abd5da5735420209a2adf4446bc 100644
--- a/chrome/browser/resources/settings/settings_main/settings_main.js
+++ b/chrome/browser/resources/settings/settings_main/settings_main.js
@@ -45,7 +45,8 @@ Polymer({
},
/**
- * Controls which main pages are displayed via dom-ifs.
+ * Controls which main pages are displayed via dom-ifs, based on the current
+ * route and the Advanced toggle state.
* @private {!MainPageVisibility}
*/
showPages_: {
@@ -145,6 +146,27 @@ Polymer({
!this.hasExpandedSection_;
},
+ /**
+ * @return {boolean} Whether to show the basic page, taking into account both
+ * routing and search state.
+ * @private
+ */
+ showBasicPage_: function() {
+ return this.showPages_.basic || (
+ this.inSearchMode_ && !this.hasExpandedSection_);
+ },
+
+ /**
+ * @return {boolean} Whether to show the advanced page, taking into account
+ * both routing and search state.
+ * @private
+ */
+ showAdvancedPage_: function() {
+ return this.showPages_.advanced || (
+ this.inSearchMode_ && !this.hasExpandedSection_);
+ },
+
+ /** @param {!settings.Route} newRoute */
currentRouteChanged: function(newRoute) {
// When the route changes from a sub-page to the main page, immediately
// update hasExpandedSection_ to unhide the other sections.
@@ -260,13 +282,11 @@ Polymer({
* @return {!Promise} A promise indicating that searching finished.
*/
searchContents: function(query) {
+ // Trigger rendering of the basic and advanced pages and search once ready.
this.inSearchMode_ = true;
this.ensureInDefaultSearchPage_();
this.toolbarSpinnerActive = true;
- // Trigger rendering of the basic and advanced pages and search once ready.
- this.showPages_ = {about: false, basic: true, advanced: true};
-
return new Promise(function(resolve, reject) {
setTimeout(function() {
var whenSearchDone = settings.getSearchManager().search(
@@ -289,14 +309,6 @@ Polymer({
this.inSearchMode_ = !request.isSame('');
this.showNoResultsFound_ =
this.inSearchMode_ && !request.didFindMatches();
-
- if (!this.inSearchMode_) {
- // Restore the "advanced" page visibility as it was before search
- // was initiated.
- this.showPages_ = {
- about: false, basic: true, advanced: this.advancedToggleExpanded_,
- };
- }
}.bind(this));
}.bind(this), 0);
}.bind(this));

Powered by Google App Engine
This is Rietveld 408576698