Index: chrome/browser/resources/settings/route.js |
diff --git a/chrome/browser/resources/settings/route.js b/chrome/browser/resources/settings/route.js |
index 09644846cbb7c01a48d8082cabb19fdb677d6d67..965335960025905d9271fa20cc143c762f62013e 100644 |
--- a/chrome/browser/resources/settings/route.js |
+++ b/chrome/browser/resources/settings/route.js |
@@ -6,14 +6,14 @@ cr.define('settings', function() { |
/** |
* Class for navigable routes. May only be instantiated within this file. |
* @constructor |
- * @param {string} url |
+ * @param {string} path |
* @private |
*/ |
- var Route = function(url) { |
- this.url = url; |
+ var Route = function(path) { |
+ this.path = path; |
- /** @private {?settings.Route} */ |
- this.parent_ = null; |
+ /** @type {?settings.Route} */ |
+ this.parent = null; |
// Below are all legacy properties to provide compatibility with the old |
// routing system. TODO(tommycli): Remove once routing refactor complete. |
@@ -36,10 +36,10 @@ cr.define('settings', function() { |
// |path| extends this route's path if it doesn't have a leading slash. |
// If it does have a leading slash, it's just set as the new route's URL. |
- var newUrl = path[0] == '/' ? path : this.url + '/' + path; |
+ var newUrl = path[0] == '/' ? path : this.path + '/' + path; |
var route = new Route(newUrl); |
- route.parent_ = this; |
+ route.parent = this; |
route.page = this.page; |
route.section = this.section; |
route.subpage = this.subpage.slice(); // Shallow copy. |
@@ -52,13 +52,13 @@ cr.define('settings', function() { |
/** |
* Returns a new Route instance that's a child dialog of this route. |
- * @param {string} url |
+ * @param {string} path |
* @param {string} dialogName |
* @return {!settings.Route} |
* @private |
*/ |
- createDialog: function(url, dialogName) { |
- var route = this.createChild(url); |
+ createDialog: function(path, dialogName) { |
+ var route = this.createChild(path); |
route.dialog = dialogName; |
return route; |
}, |
@@ -66,13 +66,13 @@ cr.define('settings', function() { |
/** |
* Returns a new Route instance that's a child section of this route. |
* TODO(tommycli): Remove once we've obsoleted the concept of sections. |
- * @param {string} url |
+ * @param {string} path |
* @param {string} section |
* @return {!settings.Route} |
* @private |
*/ |
- createSection: function(url, section) { |
- var route = this.createChild(url); |
+ createSection: function(path, section) { |
+ var route = this.createChild(path); |
route.section = section; |
return route; |
}, |
@@ -83,7 +83,7 @@ cr.define('settings', function() { |
* @return {boolean} |
*/ |
isDescendantOf: function(route) { |
- for (var parent = this.parent_; parent != null; parent = parent.parent_) { |
+ for (var parent = this.parent; parent != null; parent = parent.parent) { |
if (route == parent) |
return true; |
} |
@@ -140,7 +140,7 @@ cr.define('settings', function() { |
r.DEVICE = r.BASIC.createSection('/device', 'device'); |
r.POINTERS = r.DEVICE.createChild('/pointer-overlay', 'pointers'); |
- r.KEYBARD = r.DEVICE.createChild('/keyboard-overlay', 'keyboard'); |
+ r.KEYBOARD = r.DEVICE.createChild('/keyboard-overlay', 'keyboard'); |
r.DISPLAY = r.DEVICE.createChild('/display', 'display'); |
</if> |
@@ -262,7 +262,15 @@ cr.define('settings', function() { |
r.DETAILED_BUILD_INFO.section = 'about'; |
</if> |
+ /** |
+ * Use this function (and only this function) to navigate within Settings. |
+ * This function is set by settings-router once it is created. |
+ * @type {?function(!settings.Route):void} |
+ */ |
+ var navigateTo = null; |
+ |
return { |
Route: Route, |
+ navigateTo: navigateTo, |
}; |
}); |