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

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

Issue 2153113003: Settings Router Refactor: Migrate canonical route list to new-style. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments 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 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 * @typedef {{ 6 * @typedef {{
7 * dialog: (string|undefined), 7 * dialog: (string|undefined),
8 * page: string, 8 * page: string,
9 * section: string, 9 * section: string,
10 * subpage: !Array<string>, 10 * subpage: !Array<string>,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 }; 89 };
90 }, 90 },
91 }, 91 },
92 }, 92 },
93 93
94 94
95 /** 95 /**
96 * @private {!Array<!CanonicalRoute>} 96 * @private {!Array<!CanonicalRoute>}
97 * The 'url' property is not accessible to other elements. 97 * The 'url' property is not accessible to other elements.
98 */ 98 */
99 canonicalRoutes_: [ 99 canonicalRoutes_: Object.keys(settings.Route).map(function(key) {
100 { 100 return settings.Route[key];
101 url: '/', 101 }),
102 page: 'basic',
103 section: '',
104 subpage: [],
105 },
106 {
107 url: '/help',
108 page: 'about',
109 section: '',
110 subpage: [],
111 },
112 <if expr="chromeos">
113 {
114 url: '/help/details',
115 page: 'about',
116 section: 'about',
117 subpage: ['detailed-build-info'],
118 },
119 </if>
120 {
121 url: '/advanced',
122 page: 'advanced',
123 section: '',
124 subpage: [],
125 },
126 <if expr="chromeos">
127 {
128 url: '/internet',
129 page: 'basic',
130 section: 'internet',
131 subpage: [],
132 },
133 {
134 url: '/networkDetail',
135 page: 'basic',
136 section: 'internet',
137 subpage: ['network-detail'],
138 },
139 {
140 url: '/knownNetworks',
141 page: 'basic',
142 section: 'internet',
143 subpage: ['known-networks'],
144 },
145 </if>
146 {
147 url: '/appearance',
148 page: 'basic',
149 section: 'appearance',
150 subpage: [],
151 },
152 {
153 url: '/fonts',
154 page: 'basic',
155 section: 'appearance',
156 subpage: ['appearance-fonts'],
157 },
158 {
159 url: '/defaultBrowser',
160 page: 'basic',
161 section: 'defaultBrowser',
162 subpage: [],
163 },
164 {
165 url: '/search',
166 page: 'basic',
167 section: 'search',
168 subpage: [],
169 },
170 {
171 url: '/searchEngines',
172 page: 'basic',
173 section: 'search',
174 subpage: ['search-engines'],
175 },
176 {
177 url: '/onStartup',
178 page: 'basic',
179 section: 'onStartup',
180 subpage: [],
181 },
182 {
183 url: '/people',
184 page: 'basic',
185 section: 'people',
186 subpage: [],
187 },
188 <if expr="chromeos">
189 {
190 url: '/changePicture',
191 page: 'basic',
192 section: 'people',
193 subpage: ['changePicture'],
194 },
195 </if>
196 <if expr="not chromeos">
197 {
198 url: '/manageProfile',
199 page: 'basic',
200 section: 'people',
201 subpage: ['manageProfile'],
202 },
203 </if>
204 {
205 url: '/syncSetup',
206 page: 'basic',
207 section: 'people',
208 subpage: ['sync'],
209 },
210 <if expr="chromeos">
211 {
212 url: '/quickUnlock/authenticate',
213 page: 'basic',
214 section: 'people',
215 subpage: ['quick-unlock-authenticate'],
216 },
217 {
218 url: '/quickUnlock/chooseMethod',
219 page: 'basic',
220 section: 'people',
221 subpage: ['quick-unlock-choose-method'],
222 },
223 {
224 url: '/quickUnlock/setupPin',
225 page: 'basic',
226 section: 'people',
227 subpage: ['quick-unlock-choose-method', 'quick-unlock-setup-pin'],
228 },
229 {
230 url: '/accounts',
231 page: 'basic',
232 section: 'people',
233 subpage: ['users'],
234 },
235 </if>
236 {
237 url: '/privacy',
238 page: 'advanced',
239 section: 'privacy',
240 subpage: [],
241 },
242 {
243 url: '/certificates',
244 page: 'advanced',
245 section: 'privacy',
246 subpage: ['manage-certificates'],
247 },
248 {
249 url: '/siteSettings',
250 page: 'advanced',
251 section: 'privacy',
252 subpage: ['site-settings'],
253 },
254 // Site Category routes.
255 {
256 url: '/siteSettings/all',
257 page: 'advanced',
258 section: 'privacy',
259 subpage: ['site-settings', 'all-sites'],
260 },
261 {
262 url: '/siteSettings/automaticDownloads',
263 page: 'advanced',
264 section: 'privacy',
265 subpage: ['site-settings', 'site-settings-category-automatic-downloads'],
266 },
267 {
268 url: '/siteSettings/backgroundSync',
269 page: 'advanced',
270 section: 'privacy',
271 subpage: ['site-settings', 'site-settings-category-background-sync'],
272 },
273 {
274 url: '/siteSettings/camera',
275 page: 'advanced',
276 section: 'privacy',
277 subpage: ['site-settings', 'site-settings-category-camera'],
278 },
279 {
280 url: '/siteSettings/cookies',
281 page: 'advanced',
282 section: 'privacy',
283 subpage: ['site-settings', 'site-settings-category-cookies'],
284 },
285 {
286 url: '/siteSettings/fullscreen',
287 page: 'advanced',
288 section: 'privacy',
289 subpage: ['site-settings', 'site-settings-category-fullscreen'],
290 },
291 {
292 url: '/siteSettings/images',
293 page: 'advanced',
294 section: 'privacy',
295 subpage: ['site-settings', 'site-settings-category-images'],
296 },
297 {
298 url: '/siteSettings/handlers',
299 page: 'advanced',
300 section: 'privacy',
301 subpage: ['site-settings', 'protocol-handlers'],
302 },
303 {
304 url: '/siteSettings/javascript',
305 page: 'advanced',
306 section: 'privacy',
307 subpage: ['site-settings', 'site-settings-category-javascript'],
308 },
309 {
310 url: '/siteSettings/keygen',
311 page: 'advanced',
312 section: 'privacy',
313 subpage: ['site-settings', 'site-settings-category-keygen'],
314 },
315 {
316 url: '/siteSettings/location',
317 page: 'advanced',
318 section: 'privacy',
319 subpage: ['site-settings', 'site-settings-category-location'],
320 },
321 {
322 url: '/siteSettings/microphone',
323 page: 'advanced',
324 section: 'privacy',
325 subpage: ['site-settings', 'site-settings-category-microphone'],
326 },
327 {
328 url: '/siteSettings/notifications',
329 page: 'advanced',
330 section: 'privacy',
331 subpage: ['site-settings', 'site-settings-category-notifications'],
332 },
333 {
334 url: '/siteSettings/plugins',
335 page: 'advanced',
336 section: 'privacy',
337 subpage: ['site-settings', 'site-settings-category-plugins'],
338 },
339 {
340 url: '/siteSettings/popups',
341 page: 'advanced',
342 section: 'privacy',
343 subpage: ['site-settings', 'site-settings-category-popups'],
344 },
345 {
346 url: '/siteSettings/unsandboxedPlugins',
347 page: 'advanced',
348 section: 'privacy',
349 subpage: ['site-settings', 'site-settings-category-unsandboxed-plugins'],
350 },
351 // Site details routes.
352 {
353 url: '/siteSettings/all/details',
354 page: 'advanced',
355 section: 'privacy',
356 subpage: ['site-settings', 'all-sites', 'site-details'],
357 },
358 {
359 url: '/siteSettings/automaticDownloads/details',
360 page: 'advanced',
361 section: 'privacy',
362 subpage: ['site-settings', 'site-settings-category-automatic-downloads',
363 'site-details'],
364 },
365 {
366 url: '/siteSettings/backgroundSync/details',
367 page: 'advanced',
368 section: 'privacy',
369 subpage: ['site-settings', 'site-settings-category-background-sync',
370 'site-details'],
371 },
372 {
373 url: '/siteSettings/camera/details',
374 page: 'advanced',
375 section: 'privacy',
376 subpage: ['site-settings', 'site-settings-category-camera',
377 'site-details'],
378 },
379 {
380 url: '/siteSettings/cookies/details',
381 page: 'advanced',
382 section: 'privacy',
383 subpage: ['site-settings', 'site-settings-category-cookies',
384 'site-details'],
385 },
386 {
387 url: '/siteSettings/fullscreen/details',
388 page: 'advanced',
389 section: 'privacy',
390 subpage: ['site-settings', 'site-settings-category-fullscreen',
391 'site-details'],
392 },
393 {
394 url: '/siteSettings/images/details',
395 page: 'advanced',
396 section: 'privacy',
397 subpage: ['site-settings', 'site-settings-category-images',
398 'site-details'],
399 },
400 {
401 url: '/siteSettings/javascript/details',
402 page: 'advanced',
403 section: 'privacy',
404 subpage: ['site-settings', 'site-settings-category-javascript',
405 'site-details'],
406 },
407 {
408 url: '/siteSettings/keygen/details',
409 page: 'advanced',
410 section: 'privacy',
411 subpage: ['site-settings', 'site-settings-category-keygen',
412 'site-details'],
413 },
414 {
415 url: '/siteSettings/location/details',
416 page: 'advanced',
417 section: 'privacy',
418 subpage: ['site-settings', 'site-settings-category-location',
419 'site-details'],
420 },
421 {
422 url: '/siteSettings/microphone/details',
423 page: 'advanced',
424 section: 'privacy',
425 subpage: ['site-settings', 'site-settings-category-microphone',
426 'site-details'],
427 },
428 {
429 url: '/siteSettings/notifications/details',
430 page: 'advanced',
431 section: 'privacy',
432 subpage: ['site-settings', 'site-settings-category-notifications',
433 'site-details'],
434 },
435 {
436 url: '/siteSettings/plugins/details',
437 page: 'advanced',
438 section: 'privacy',
439 subpage: ['site-settings', 'site-settings-category-plugins',
440 'site-details'],
441 },
442 {
443 url: '/siteSettings/popups/details',
444 page: 'advanced',
445 section: 'privacy',
446 subpage: ['site-settings', 'site-settings-category-popups',
447 'site-details'],
448 },
449 {
450 url: '/siteSettings/unsandboxedPlugins/details',
451 page: 'advanced',
452 section: 'privacy',
453 subpage: ['site-settings', 'site-settings-category-unsandsboxed-plugins',
454 'site-details'],
455 },
456 {
457 url: '/clearBrowserData',
458 page: 'advanced',
459 section: 'privacy',
460 subpage: [],
461 dialog: 'clear-browsing-data',
462 },
463 <if expr="chromeos">
464 {
465 url: '/dateTime',
466 page: 'advanced',
467 section: 'dateTime',
468 subpage: [],
469 },
470 {
471 url: '/bluetooth',
472 page: 'advanced',
473 section: 'bluetooth',
474 subpage: [],
475 },
476 {
477 url: '/bluetoothAddDevice',
478 page: 'advanced',
479 section: 'bluetooth',
480 subpage: ['bluetooth-add-device'],
481 },
482 {
483 url: '/bluetoothAddDevice/bluetoothPairDevice',
484 page: 'advanced',
485 section: 'bluetooth',
486 subpage: ['bluetooth-add-device', 'bluetooth-pair-device'],
487 },
488 </if>
489 {
490 url: '/autofill',
491 page: 'advanced',
492 section: 'passwordsAndForms',
493 subpage: ['manage-autofill'],
494 },
495 {
496 url: '/passwords',
497 page: 'advanced',
498 section: 'passwordsAndForms',
499 subpage: [],
500 },
501 {
502 url: '/managePasswords',
503 page: 'advanced',
504 section: 'passwordsAndForms',
505 subpage: ['manage-passwords'],
506 },
507 {
508 url: '/languages',
509 page: 'advanced',
510 section: 'languages',
511 subpage: [],
512 },
513 {
514 url: '/manageLanguages',
515 page: 'advanced',
516 section: 'languages',
517 subpage: ['manage-languages'],
518 },
519 {
520 url: '/languages/edit',
521 page: 'advanced',
522 section: 'languages',
523 subpage: ['language-detail'],
524 },
525 <if expr="chromeos">
526 {
527 url: '/inputMethods',
528 page: 'advanced',
529 section: 'languages',
530 subpage: ['manage-input-methods'],
531 },
532 </if>
533 <if expr="not is_macosx">
534 {
535 url: '/editDictionary',
536 page: 'advanced',
537 section: 'languages',
538 subpage: ['edit-dictionary'],
539 },
540 </if>
541 {
542 url: '/downloadsDirectory',
543 page: 'advanced',
544 section: 'downloads',
545 subpage: [],
546 },
547 {
548 url: '/printing',
549 page: 'advanced',
550 section: 'printing',
551 subpage: [],
552 },
553 <if expr="chromeos">
554 {
555 url: '/cupsPrinters',
556 page: 'advanced',
557 section: 'printing',
558 subpage: ['cups-printers'],
559 },
560 </if>
561 {
562 url: '/cloudPrinters',
563 page: 'advanced',
564 section: 'printing',
565 subpage: ['cloud-printers'],
566 },
567 {
568 url: '/accessibility',
569 page: 'advanced',
570 section: 'a11y',
571 subpage: [],
572 },
573 {
574 url: '/system',
575 page: 'advanced',
576 section: 'system',
577 subpage: [],
578 },
579 {
580 url: '/reset',
581 page: 'advanced',
582 section: 'reset',
583 subpage: [],
584 },
585 <if expr="chromeos">
586 {
587 url: '/device',
588 page: 'basic',
589 section: 'device',
590 subpage: [],
591 },
592 {
593 url: '/pointer-overlay',
594 page: 'basic',
595 section: 'device',
596 subpage: ['touchpad'],
597 },
598 {
599 url: '/keyboard-overlay',
600 page: 'basic',
601 section: 'device',
602 subpage: ['keyboard'],
603 },
604 {
605 url: '/display',
606 page: 'basic',
607 section: 'device',
608 subpage: ['display'],
609 },
610 </if>
611 ],
612 102
613 /** 103 /**
614 * Sets up a history popstate observer. 104 * Sets up a history popstate observer.
615 */ 105 */
616 created: function() { 106 created: function() {
617 window.addEventListener('popstate', function(event) { 107 window.addEventListener('popstate', function(event) {
618 if (event.state && event.state.page) 108 if (event.state && event.state.page)
619 this.currentRoute = event.state; 109 this.currentRoute = event.state;
620 }.bind(this)); 110 }.bind(this));
621 }, 111 },
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 window.history.replaceState(historicRoute, document.title); 158 window.history.replaceState(historicRoute, document.title);
669 } 159 }
670 160
671 return; 161 return;
672 } 162 }
673 } 163 }
674 164
675 assertNotReached('Route not found: ' + JSON.stringify(newRoute)); 165 assertNotReached('Route not found: ' + JSON.stringify(newRoute));
676 }, 166 },
677 }); 167 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698