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

Unified Diff: chrome/browser/resources/settings/settings_menu/settings_menu.js

Issue 2156413002: Settings Router Refactor: Migrate to settings.Route.navigateTo calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge origin/master Created 4 years, 5 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_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]);
},
/**

Powered by Google App Engine
This is Rietveld 408576698