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

Unified Diff: chrome/browser/resources/settings/settings_page/main_page_behavior.js

Issue 2224163002: Settings Router Refactor: Replace route.subpage usage with route.path (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 4 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_page/main_page_behavior.js
diff --git a/chrome/browser/resources/settings/settings_page/main_page_behavior.js b/chrome/browser/resources/settings/settings_page/main_page_behavior.js
index b1b31d65f94fdb1f079fe57c82c4d301d3aa31a0..59c66b29a452188ab468b30267263a1cf5f01f49 100644
--- a/chrome/browser/resources/settings/settings_page/main_page_behavior.js
+++ b/chrome/browser/resources/settings/settings_page/main_page_behavior.js
@@ -39,12 +39,12 @@ var MainPageBehaviorImpl = {
/**
* @param {!settings.Route} newRoute
- * @param {!settings.Route} oldRoute
+ * @param {settings.Route} oldRoute
*/
currentRouteChanged: function(newRoute, oldRoute) {
// Allow the page to load before expanding the section. TODO(michaelpg):
// Time this better when refactoring settings-animated-pages.
- if (!oldRoute && newRoute.subpage.length)
+ if (!oldRoute && newRoute.isSubpage())
setTimeout(this.tryTransitionToSection_.bind(this));
else
this.tryTransitionToSection_();
@@ -75,7 +75,7 @@ var MainPageBehaviorImpl = {
this.$$('settings-section.expanded'));
if (expandedSection) {
// If the section shouldn't be expanded, collapse it.
- if (!currentRoute.subpage.length || expandedSection != currentSection) {
+ if (!currentRoute.isSubpage() || expandedSection != currentSection) {
promise = this.collapseSection_(expandedSection);
// Scroll to the collapsed section. TODO(michaelpg): This can look weird
// because the collapse we just scheduled calculated its end target
@@ -86,7 +86,7 @@ var MainPageBehaviorImpl = {
}
} else if (currentSection) {
// Expand the section into a subpage or scroll to it on the main page.
- if (currentRoute.subpage.length)
+ if (currentRoute.isSubpage())
promise = this.expandSection_(currentSection);
else
this.scrollToSection_();
@@ -113,7 +113,7 @@ var MainPageBehaviorImpl = {
// Cancel the animation to go back to the main page if the animating
// section shouldn't be expanded.
if (animatingSection.section != currentRoute.section ||
- !currentRoute.subpage.length) {
+ !currentRoute.isSubpage()) {
this.currentAnimation_.cancel();
}
// Otherwise, let the expand animation continue.
@@ -121,7 +121,7 @@ var MainPageBehaviorImpl = {
}
assert(animatingSection.classList.contains('collapsing'));
- if (!currentRoute.subpage.length)
+ if (!currentRoute.isSubpage())
return;
// If the collapsing section actually matches the current route's section,

Powered by Google App Engine
This is Rietveld 408576698