Chromium Code Reviews| 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 30eb744895e2bfcd570189da2d7104532ef06f75..1981b30ece091e2a04956197cab0e3c8b22699c1 100644 |
| --- a/chrome/browser/resources/settings/settings_main/settings_main.js |
| +++ b/chrome/browser/resources/settings/settings_main/settings_main.js |
| @@ -9,6 +9,8 @@ |
| Polymer({ |
| is: 'settings-main', |
| + behaviors: [settings.RouteObserverBehavior], |
| + |
| properties: { |
| /** |
| * Preferences state. |
| @@ -18,16 +20,6 @@ Polymer({ |
| notify: true, |
| }, |
| - /** |
| - * The current active route. |
| - * @type {!settings.Route} |
| - */ |
| - currentRoute: { |
| - type: Object, |
| - notify: true, |
| - observer: 'currentRouteChanged_', |
| - }, |
| - |
| /** @private */ |
| advancedToggleExpanded_: { |
| type: Boolean, |
| @@ -129,10 +121,8 @@ Polymer({ |
| return showBasicPage && !inSubpage; |
| }, |
| - /** |
| - * @private |
| - */ |
| - currentRouteChanged_: function(newRoute) { |
| + /** @protected */ |
| + currentRouteChanged: function(newRoute) { |
| this.inSubpage_ = newRoute.subpage.length > 0; |
| this.style.height = this.inSubpage_ ? '100%' : ''; |
| @@ -171,12 +161,11 @@ Polymer({ |
| * @private |
| */ |
| overscrollHeight_: function() { |
| - if (!this.currentRoute || this.currentRoute.subpage.length != 0 || |
| - this.showPages_.about) { |
| + var route = settings.getCurrentRoute(); |
|
Dan Beam
2016/08/05 18:25:19
can |route| be falsy?
tommycli
2016/08/05 18:54:06
Done.
|
| + if (!route || route.subpage.length != 0 || this.showPages_.about) |
| return 0; |
| - } |
| - var query = 'settings-section[section="' + this.currentRoute.section + '"]'; |
| + var query = 'settings-section[section="' + route.section + '"]'; |
| var topSection = this.$$('settings-basic-page').$$(query); |
| if (!topSection && this.showPages_.advanced) |
| topSection = this.$$('settings-advanced-page').$$(query); |