Chromium Code Reviews| Index: chrome/browser/resources/settings/settings_page/settings_animated_pages.js |
| diff --git a/chrome/browser/resources/settings/settings_page/settings_animated_pages.js b/chrome/browser/resources/settings/settings_page/settings_animated_pages.js |
| index 55131d1f9f681c87c634337493931549346c1050..8afbfca93cd3f44fa63bf03c1b57663ae26ca338 100644 |
| --- a/chrome/browser/resources/settings/settings_page/settings_animated_pages.js |
| +++ b/chrome/browser/resources/settings/settings_page/settings_animated_pages.js |
| @@ -9,30 +9,22 @@ |
| * |
| * Example: |
| * |
| - * <settings-animated-pages current-route="{{currentRoute}}" |
| - * section="privacy"> |
| + * <settings-animated-pages section="privacy"> |
| * <!-- Insert your section controls here --> |
| * </settings-animated-pages> |
| */ |
| Polymer({ |
| is: 'settings-animated-pages', |
| - properties: { |
| - /** |
| - * Contains the current route. |
| - */ |
| - currentRoute: { |
| - type: Object, |
| - notify: true, |
| - observer: 'currentRouteChanged_', |
| - }, |
| + behaviors: [settings.RouteObserverBehavior], |
| + properties: { |
| /** |
| * Routes with this section activate this element. For instance, if this |
| * property is 'search', and currentRoute.section is also set to 'search', |
| * this element will display the subpage in currentRoute.subpage. |
| * |
| - * The section name must match the name specified in settings_router.js. |
| + * The section name must match the name specified in route.js. |
| */ |
| section: { |
| type: String, |
| @@ -46,7 +38,9 @@ Polymer({ |
| this.lightDomChanged_.bind(this)); |
| this.addEventListener('subpage-back', function() { |
| - settings.navigateTo(this.currentRoute.parent); |
|
Dan Beam
2016/08/05 18:25:19
all that compilation safety... and we got foiled b
michaelpg
2016/08/05 18:39:28
how do you even fire this w/out a parent? that sou
tommycli
2016/08/05 18:54:06
Done. It could be hypothetically fired when the us
|
| + var parent = settings.getCurrentRoute().parent; |
| + if (parent) |
| + settings.navigateTo(parent); |
| }.bind(this)); |
| }, |
| @@ -64,20 +58,20 @@ Polymer({ |
| }, |
| /** |
| - * Calls currentRouteChanged_ with the deferred route change info. |
| + * Calls currentRouteChanged with the deferred route change info. |
| * @private |
| */ |
| runQueuedRouteChange_: function() { |
| if (!this.queuedRouteChange_) |
| return; |
| - this.async(this.currentRouteChanged_.bind( |
| + this.async(this.currentRouteChanged.bind( |
| this, |
| this.queuedRouteChange_.newRoute, |
| this.queuedRouteChange_.oldRoute)); |
| }, |
| - /** @private */ |
| - currentRouteChanged_: function(newRoute, oldRoute) { |
| + /** @protected */ |
| + currentRouteChanged: function(newRoute, oldRoute) { |
| if (newRoute.section == this.section && newRoute.subpage.length > 0) { |
| this.switchToSubpage_(newRoute, oldRoute); |
| } else { |
| @@ -139,7 +133,7 @@ Polymer({ |
| * @private |
| */ |
| ensureSubpageInstance_: function() { |
| - var id = this.currentRoute.subpage.slice(-1)[0]; |
| + var id = settings.getCurrentRoute().subpage.slice(-1)[0]; |
| var template = Polymer.dom(this).querySelector( |
| 'template[name="' + id + '"]'); |