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

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

Issue 2210933004: Settings Router Refactor: Kill settings-router. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix 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/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..682ead2dc14c8c474601fbe74938ce5aba6b00c1 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);
+ var parent = settings.getCurrentRoute().parent;
+ assert(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 + '"]');

Powered by Google App Engine
This is Rietveld 408576698