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

Side by Side Diff: chrome/browser/resources/settings/settings_page/settings_router.js

Issue 1561413003: Reland: Settings People Revamp: Implement Chrome Profile name/icon selection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * 'settings-router' is a simple router for settings. Its responsibilities: 7 * 'settings-router' is a simple router for settings. Its responsibilities:
8 * - Update the URL when the routing state changes. 8 * - Update the URL when the routing state changes.
9 * - Initialize the routing state with the initial URL. 9 * - Initialize the routing state with the initial URL.
10 * - Process and validate all routing state changes. 10 * - Process and validate all routing state changes.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 }, 59 },
60 60
61 /** 61 /**
62 * Page titles for the currently active route. Updated by the currentRoute 62 * Page titles for the currently active route. Updated by the currentRoute
63 * property observer. 63 * property observer.
64 * @type {{pageTitle: string, subpageTitles: Array<string>}} 64 * @type {{pageTitle: string, subpageTitles: Array<string>}}
65 */ 65 */
66 currentRouteTitles: { 66 currentRouteTitles: {
67 notify: true, 67 notify: true,
68 type: Object, 68 type: Object,
69 value: function() { return {}; }, 69 value: function() {
70 return {
71 pageTitle: '',
72 subpageTitles: [],
73 };
74 },
70 }, 75 },
71 }, 76 },
72 77
73 78
74 /** 79 /**
75 * @private 80 * @private
76 * The 'url' property is not accessible to other elements. 81 * The 'url' property is not accessible to other elements.
77 */ 82 */
78 routes_: [ 83 routes_: [
79 { 84 {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 subpage: ['search-engines'], 125 subpage: ['search-engines'],
121 subpageTitles: ['searchEnginesPageTitle'], 126 subpageTitles: ['searchEnginesPageTitle'],
122 }, 127 },
123 { 128 {
124 url: '/searchEngines/advanced', 129 url: '/searchEngines/advanced',
125 page: 'basic', 130 page: 'basic',
126 section: 'search', 131 section: 'search',
127 subpage: ['search-engines', 'search-engines-advanced'], 132 subpage: ['search-engines', 'search-engines-advanced'],
128 subpageTitles: ['searchEnginesPageTitle', 'advancedPageTitle'], 133 subpageTitles: ['searchEnginesPageTitle', 'advancedPageTitle'],
129 }, 134 },
135 <if expr="not chromeos">
136 {
137 url: '/manageProfile',
138 page: 'basic',
139 section: 'people',
140 subpage: ['manageProfile'],
141 subpageTitles: ['editPerson'],
142 },
143 </if>
130 { 144 {
131 url: '/syncSetup', 145 url: '/syncSetup',
132 page: 'basic', 146 page: 'basic',
133 section: 'people', 147 section: 'people',
134 subpage: ['sync'], 148 subpage: ['sync'],
135 subpageTitles: ['syncPageTitle'], 149 subpageTitles: ['syncPageTitle'],
136 }, 150 },
137 <if expr="chromeos"> 151 <if expr="chromeos">
138 { 152 {
139 url: '/accounts', 153 url: '/accounts',
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 var historicState = { 276 var historicState = {
263 inHistory: true, 277 inHistory: true,
264 page: newRoute.page, 278 page: newRoute.page,
265 section: newRoute.section, 279 section: newRoute.section,
266 subpage: newRoute.subpage, 280 subpage: newRoute.subpage,
267 }; 281 };
268 282
269 // Push the current route to the history state, so when the user 283 // Push the current route to the history state, so when the user
270 // navigates with the browser back button, we can recall the route. 284 // navigates with the browser back button, we can recall the route.
271 if (oldRoute) { 285 if (oldRoute) {
272 history.pushState(historicState, null, route.url); 286 window.history.pushState(historicState, document.title, route.url);
273 } else { 287 } else {
274 // For the very first route (oldRoute will be undefined), we replace 288 // For the very first route (oldRoute will be undefined), we replace
275 // the existing state instead of pushing a new one. This is to allow 289 // the existing state instead of pushing a new one. This is to allow
276 // the user to use the browser back button to exit Settings entirely. 290 // the user to use the browser back button to exit Settings entirely.
277 history.replaceState(historicState, null); 291 window.history.replaceState(historicState, document.title);
278 } 292 }
279 293
280 return; 294 return;
281 } 295 }
282 } 296 }
283 297
284 assertNotReached('Route not found: ' + JSON.stringify(newRoute)); 298 assertNotReached('Route not found: ' + JSON.stringify(newRoute));
285 }, 299 },
286 }); 300 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698