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

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

Issue 1916323002: [MD settings] side nav routing to page sections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix for people page test Created 4 years, 8 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_router.js
diff --git a/chrome/browser/resources/settings/settings_page/settings_router.js b/chrome/browser/resources/settings/settings_page/settings_router.js
index 85784c1ffd1eca2108e0ea76fd307d5c15f4fd1b..7b9b99eaf74cafd370f1a644f8a412515506e35f 100644
--- a/chrome/browser/resources/settings/settings_page/settings_router.js
+++ b/chrome/browser/resources/settings/settings_page/settings_router.js
@@ -2,6 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
michaelpg 2016/04/29 20:19:04 remove newline
dschuyler 2016/04/29 21:27:46 Done.
+/**
+ * @typedef {{
+ * url: string,
+ * page: string,
+ * section: string,
+ * subpage: !Array<string>,
+ * }}
+ */
+var SettingsRoute;
michaelpg 2016/04/29 20:19:04 nice
dschuyler 2016/04/29 21:27:46 Acknowledged.
+
/**
* @fileoverview
* 'settings-router' is a simple router for settings. Its responsibilities:
@@ -31,6 +42,7 @@ Polymer({
* the user is on. The previous elements are the ancestor subpages. This
* enables support for multiple paths to the same subpage. This is used by
* both the Back button and the Breadcrumb to determine ancestor subpages.
+ * @type {SettingsRoute}
*/
currentRoute: {
notify: true,
@@ -43,6 +55,7 @@ Polymer({
var route = this.routes_[i];
if (route.url == window.location.pathname) {
return {
+ url: route.url,
page: route.page,
section: route.section,
subpage: route.subpage,
@@ -72,11 +85,11 @@ Polymer({
},
- /**
- * @private
- * The 'url' property is not accessible to other elements.
- */
- routes_: [
+ /**
+ * @private {!Array<SettingsRoute>}
michaelpg 2016/04/29 20:19:04 !SettingsRoute
dschuyler 2016/04/29 21:27:46 Done.
+ * The 'url' property is not accessible to other elements.
+ */
+ routes_: [
{
url: '/',
page: 'basic',
@@ -91,6 +104,12 @@ Polymer({
},
<if expr="chromeos">
{
+ url: '/internet',
+ page: 'basic',
+ section: 'internet',
+ subpage: [],
+ },
+ {
url: '/networkDetail',
page: 'basic',
section: 'internet',
@@ -104,12 +123,30 @@ Polymer({
},
</if>
{
+ url: '/appearance',
+ page: 'basic',
+ section: 'appearance',
+ subpage: [],
+ },
+ {
url: '/fonts',
page: 'basic',
section: 'appearance',
subpage: ['appearance-fonts'],
},
{
+ url: '/defaultBrowser',
+ page: 'basic',
+ section: 'defaultBrowser',
+ subpage: [],
+ },
+ {
+ url: '/search',
+ page: 'basic',
+ section: 'search',
+ subpage: [],
+ },
+ {
url: '/searchEngines',
page: 'basic',
section: 'search',
@@ -121,6 +158,18 @@ Polymer({
section: 'search',
subpage: ['search-engines', 'search-engines-advanced'],
},
+ {
+ url: '/onStartup',
+ page: 'basic',
+ section: 'onStartup',
+ subpage: [],
+ },
+ {
+ url: '/people',
+ page: 'basic',
+ section: 'people',
+ subpage: [],
+ },
<if expr="chromeos">
{
url: '/changePicture',
@@ -152,6 +201,12 @@ Polymer({
},
</if>
{
+ url: '/advanced',
+ page: 'advanced',
+ section: 'privacy',
+ subpage: [],
+ },
+ {
url: '/certificates',
page: 'advanced',
section: 'privacy',
@@ -302,6 +357,12 @@ Polymer({
},
<if expr="chromeos">
{
+ url: '/bluetooth',
+ page: 'advanced',
+ section: 'bluetooth',
+ subpage: [],
+ },
+ {
url: '/bluetoothAddDevice',
page: 'advanced',
section: 'bluetooth',
@@ -315,12 +376,24 @@ Polymer({
},
</if>
{
+ url: '/pw', /* TODO(dschuyler): find a better url. */
michaelpg 2016/04/29 20:19:04 nit: 2 spaces separation and // style inline comme
dschuyler 2016/04/29 21:27:46 Done.
+ page: 'advanced',
+ section: 'passwordsAndForms',
+ subpage: [],
+ },
+ {
url: '/passwords',
page: 'advanced',
section: 'passwordsAndForms',
subpage: ['manage-passwords'],
},
{
+ url: '/ln', /* TODO(dschuyler): find a better url. */
+ page: 'advanced',
+ section: 'languages',
+ subpage: [],
+ },
+ {
url: '/languages',
page: 'advanced',
section: 'languages',
@@ -348,8 +421,38 @@ Polymer({
subpage: ['edit-dictionary'],
},
</if>
+ {
+ url: '/downloadsDirectory',
+ page: 'advanced',
+ section: 'downloads',
+ subpage: [],
+ },
+ {
+ url: '/accessibility',
+ page: 'advanced',
+ section: 'a11y',
+ subpage: [],
+ },
+ {
+ url: '/system',
+ page: 'advanced',
+ section: 'system',
+ subpage: [],
+ },
+ {
+ url: '/reset',
+ page: 'advanced',
+ section: 'reset',
+ subpage: [],
+ },
<if expr="chromeos">
{
+ url: '/device',
+ page: 'basic',
+ section: 'device',
+ subpage: [],
+ },
+ {
url: '/pointer-overlay',
page: 'basic',
section: 'device',
@@ -381,10 +484,12 @@ Polymer({
},
/**
- * @private
* Is called when another element modifies the route. This observer validates
* the route change against the pre-defined list of routes, and updates the
* URL appropriately.
+ * @param {SettingsRoute} newRoute Where we're headed.
michaelpg 2016/04/29 20:19:04 !
dschuyler 2016/04/29 21:27:46 Done.
+ * @param {SettingsRoute} oldRoute Where we've been.
michaelpg 2016/04/29 20:19:04 !SettingsRoute|undefined
dschuyler 2016/04/29 21:27:46 Done.
+ * @private
*/
currentRouteChanged_: function(newRoute, oldRoute) {
for (var i = 0; i < this.routes_.length; ++i) {

Powered by Google App Engine
This is Rietveld 408576698