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

Side by Side Diff: chrome/browser/resources/settings/route.js

Issue 2754563002: MD Settings: Lazy load the contents of the "advanced" settings. (Closed)
Patch Set: Address comments. Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 cr.define('settings', function() { 5 cr.define('settings', function() {
6 /** 6 /**
7 * Class for navigable routes. May only be instantiated within this file. 7 * Class for navigable routes. May only be instantiated within this file.
8 * @constructor 8 * @constructor
9 * @param {string} path 9 * @param {string} path
10 * @private 10 * @private
11 */ 11 */
12 var Route = function(path) { 12 var Route = function(path) {
13 this.path = path; 13 this.path = path;
14 14
15 /** @type {?settings.Route} */ 15 /** @type {?settings.Route} */
16 this.parent = null; 16 this.parent = null;
17 17
18 /** @type {number} */ 18 /** @type {number} */
19 this.depth = 0; 19 this.depth = 0;
20 20
21 /**
22 * @type {boolean} Whether this route corresponds to a navigable
23 * dialog. Those routes don't belong to a "section".
24 */
25 this.isNavigableDialog = false;
26
21 // Below are all legacy properties to provide compatibility with the old 27 // Below are all legacy properties to provide compatibility with the old
22 // routing system. TODO(tommycli): Remove once routing refactor complete. 28 // routing system.
29
30 /** @type {string} */
23 this.section = ''; 31 this.section = '';
24 }; 32 };
25 33
26 Route.prototype = { 34 Route.prototype = {
27 /** 35 /**
28 * Returns a new Route instance that's a child of this route. 36 * Returns a new Route instance that's a child of this route.
29 * @param {string} path Extends this route's path if it doesn't contain a 37 * @param {string} path Extends this route's path if it doesn't contain a
30 * leading slash. 38 * leading slash.
31 * @return {!settings.Route} 39 * @return {!settings.Route}
32 * @private 40 * @private
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 var r = Route; 95 var r = Route;
88 96
89 // Root pages. 97 // Root pages.
90 r.BASIC = new Route('/'); 98 r.BASIC = new Route('/');
91 r.ADVANCED = new Route('/advanced'); 99 r.ADVANCED = new Route('/advanced');
92 r.ABOUT = new Route('/help'); 100 r.ABOUT = new Route('/help');
93 101
94 // Navigable dialogs. These are the only non-section children of root pages. 102 // Navigable dialogs. These are the only non-section children of root pages.
95 // These are disfavored. If we add anymore, we should add explicit support. 103 // These are disfavored. If we add anymore, we should add explicit support.
96 r.IMPORT_DATA = r.BASIC.createChild('/importData'); 104 r.IMPORT_DATA = r.BASIC.createChild('/importData');
105 r.IMPORT_DATA.isNavigableDialog = true;
97 r.SIGN_OUT = r.BASIC.createChild('/signOut'); 106 r.SIGN_OUT = r.BASIC.createChild('/signOut');
107 r.SIGN_OUT.isNavigableDialog = true;
98 r.CLEAR_BROWSER_DATA = r.ADVANCED.createChild('/clearBrowserData'); 108 r.CLEAR_BROWSER_DATA = r.ADVANCED.createChild('/clearBrowserData');
109 r.CLEAR_BROWSER_DATA.isNavigableDialog = true;
99 r.RESET_DIALOG = r.ADVANCED.createChild('/resetProfileSettings'); 110 r.RESET_DIALOG = r.ADVANCED.createChild('/resetProfileSettings');
111 r.RESET_DIALOG.isNavigableDialog = true;
100 r.TRIGGERED_RESET_DIALOG = 112 r.TRIGGERED_RESET_DIALOG =
101 r.ADVANCED.createChild('/triggeredResetProfileSettings'); 113 r.ADVANCED.createChild('/triggeredResetProfileSettings');
114 r.TRIGGERED_RESET_DIALOG.isNavigableDialog = true;
102 115
103 // <if expr="chromeos"> 116 // <if expr="chromeos">
104 r.INTERNET = r.BASIC.createSection('/internet', 'internet'); 117 r.INTERNET = r.BASIC.createSection('/internet', 'internet');
105 r.INTERNET_NETWORKS = r.INTERNET.createChild('/networks'); 118 r.INTERNET_NETWORKS = r.INTERNET.createChild('/networks');
106 r.NETWORK_DETAIL = r.INTERNET.createChild('/networkDetail'); 119 r.NETWORK_DETAIL = r.INTERNET.createChild('/networkDetail');
107 r.KNOWN_NETWORKS = r.INTERNET.createChild('/knownNetworks'); 120 r.KNOWN_NETWORKS = r.INTERNET.createChild('/knownNetworks');
108 r.BLUETOOTH = r.BASIC.createSection('/bluetooth', 'bluetooth'); 121 r.BLUETOOTH = r.BASIC.createSection('/bluetooth', 'bluetooth');
109 r.BLUETOOTH_DEVICES = r.BLUETOOTH.createChild('/bluetoothDevices'); 122 r.BLUETOOTH_DEVICES = r.BLUETOOTH.createChild('/bluetoothDevices');
110 // </if> 123 // </if>
111 124
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 getRouteForPath: getRouteForPath, 416 getRouteForPath: getRouteForPath,
404 initializeRouteFromUrl: initializeRouteFromUrl, 417 initializeRouteFromUrl: initializeRouteFromUrl,
405 resetRouteForTesting: resetRouteForTesting, 418 resetRouteForTesting: resetRouteForTesting,
406 getCurrentRoute: getCurrentRoute, 419 getCurrentRoute: getCurrentRoute,
407 getQueryParameters: getQueryParameters, 420 getQueryParameters: getQueryParameters,
408 lastRouteChangeWasPopstate: lastRouteChangeWasPopstate, 421 lastRouteChangeWasPopstate: lastRouteChangeWasPopstate,
409 navigateTo: navigateTo, 422 navigateTo: navigateTo,
410 navigateToPreviousRoute: navigateToPreviousRoute, 423 navigateToPreviousRoute: navigateToPreviousRoute,
411 }; 424 };
412 }); 425 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698