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

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: merge with master 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 70e6f517b077deafdd774ee4e7f97da48bf6508a..87bb8a9d12ba6af5207f58856ed939b53549b69d 100644
--- a/chrome/browser/resources/settings/settings_page/settings_router.js
+++ b/chrome/browser/resources/settings/settings_page/settings_router.js
@@ -3,6 +3,16 @@
// found in the LICENSE file.
/**
+ * @typedef {{
+ * url: string,
+ * page: string,
+ * section: string,
+ * subpage: !Array<string>,
+ * }}
+ */
+var SettingsRoute;
+
+/**
* @fileoverview
* 'settings-router' is a simple router for settings. Its responsibilities:
* - Update the URL when the routing state changes.
@@ -31,6 +41,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 +54,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 +84,11 @@ Polymer({
},
- /**
- * @private
- * The 'url' property is not accessible to other elements.
- */
- routes_: [
+ /**
+ * @private {!Array<!SettingsRoute>}
+ * The 'url' property is not accessible to other elements.
+ */
+ routes_: [
{
url: '/',
page: 'basic',
@@ -91,6 +103,12 @@ Polymer({
},
<if expr="chromeos">
{
+ url: '/internet',
+ page: 'basic',
+ section: 'internet',
+ subpage: [],
+ },
+ {
url: '/networkDetail',
page: 'basic',
section: 'internet',
@@ -104,12 +122,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 +157,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 +200,12 @@ Polymer({
},
</if>
{
+ url: '/advanced',
+ page: 'advanced',
+ section: 'privacy',
+ subpage: [],
+ },
+ {
url: '/certificates',
page: 'advanced',
section: 'privacy',
@@ -302,6 +356,12 @@ Polymer({
},
<if expr="chromeos">
{
+ url: '/bluetooth',
+ page: 'advanced',
+ section: 'bluetooth',
+ subpage: [],
+ },
+ {
url: '/bluetoothAddDevice',
page: 'advanced',
section: 'bluetooth',
@@ -321,12 +381,24 @@ Polymer({
subpage: ['manage-autofill'],
},
{
+ url: '/pw', // TODO(dschuyler): find a better url.
+ 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',
@@ -354,8 +426,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',
@@ -387,10 +489,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.
+ * @param {!SettingsRoute|undefined} oldRoute Where we've been.
+ * @private
*/
currentRouteChanged_: function(newRoute, oldRoute) {
for (var i = 0; i < this.routes_.length; ++i) {

Powered by Google App Engine
This is Rietveld 408576698