Index: chrome/browser/resources/settings/settings_menu/settings_menu.js |
diff --git a/chrome/browser/resources/settings/settings_menu/settings_menu.js b/chrome/browser/resources/settings/settings_menu/settings_menu.js |
index 016b1a81140829ce6b6a0cd3d660808b7fcb5cf0..cbee336f400d9572f78daddfbccffc0609e3188d 100644 |
--- a/chrome/browser/resources/settings/settings_menu/settings_menu.js |
+++ b/chrome/browser/resources/settings/settings_menu/settings_menu.js |
@@ -15,7 +15,7 @@ Polymer({ |
/** |
* The current active route. |
- * @type {!SettingsRoute} |
+ * @type {!settings.Route} |
*/ |
currentRoute: { |
type: Object, |
@@ -44,7 +44,7 @@ Polymer({ |
}, |
/** |
- * @param {!SettingsRoute} newRoute |
+ * @param {!settings.Route} newRoute |
* @private |
*/ |
currentRouteChanged_: function(newRoute) { |
@@ -82,14 +82,19 @@ Polymer({ |
*/ |
openPage_: function(event) { |
this.ripple_(/** @type {!Node} */(event.currentTarget)); |
- var submenuRoute = event.currentTarget.parentNode.dataset.page; |
- if (submenuRoute) { |
- this.currentRoute = { |
- page: submenuRoute, |
- section: event.currentTarget.dataset.section, |
- subpage: [], |
- }; |
- } |
+ var page = event.currentTarget.parentNode.dataset.page; |
+ if (!page) |
+ return; |
+ |
+ var section = event.currentTarget.dataset.section; |
+ var matchingKey = Object.keys(settings.Route).find(function(key) { |
Dan Beam
2016/07/23 00:17:12
Object.values()
tommycli
2016/07/25 16:47:20
Closure compiler doesn't accept values(). Even aft
|
+ var route = settings.Route[key]; |
+ return route.page == page && route.section == section && |
+ route.subpage.length == 0; |
Dan Beam
2016/07/23 00:17:12
can you add a TODO() about what this code should b
tommycli
2016/07/25 16:47:20
Done.
|
+ }); |
+ |
+ if (matchingKey) |
+ settings.navigateTo(settings.Route[matchingKey]); |
}, |
/** |