Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 var initializeRouteFromUrlCalled_ = false; | 259 var initializeRouteFromUrlCalled_ = false; |
| 260 | 260 |
| 261 /** | 261 /** |
| 262 * Initialize the route and query params from the URL. | 262 * Initialize the route and query params from the URL. |
| 263 */ | 263 */ |
| 264 var initializeRouteFromUrl = function() { | 264 var initializeRouteFromUrl = function() { |
| 265 assert(!initializeRouteFromUrlCalled_); | 265 assert(!initializeRouteFromUrlCalled_); |
| 266 initializeRouteFromUrlCalled_ = true; | 266 initializeRouteFromUrlCalled_ = true; |
| 267 | 267 |
| 268 var route = getRouteForPath(window.location.pathname); | 268 var route = getRouteForPath(window.location.pathname); |
| 269 if (route) { | 269 // Never allow direct navigation to ADVANCED. |
| 270 if (route && route != Route.ADVANCED) { | |
|
dschuyler
2016/08/17 22:54:12
Can we drop advanced altogether? I added it as
par
tommycli
2016/08/17 23:56:25
Can't easily drop it. It's needed to do all the AD
| |
| 270 currentRoute_ = route; | 271 currentRoute_ = route; |
| 271 currentQueryParameters_ = new URLSearchParams(window.location.search); | 272 currentQueryParameters_ = new URLSearchParams(window.location.search); |
| 272 } else { | 273 } else { |
| 273 window.history.replaceState(undefined, '', Route.BASIC.path); | 274 window.history.replaceState(undefined, '', Route.BASIC.path); |
| 274 } | 275 } |
| 275 }; | 276 }; |
| 276 | 277 |
| 277 /** | 278 /** |
| 278 * Helper function to set the current route and notify all observers. | 279 * Helper function to set the current route and notify all observers. |
| 279 * @param {!settings.Route} route | 280 * @param {!settings.Route} route |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 326 return { | 327 return { |
| 327 Route: Route, | 328 Route: Route, |
| 328 RouteObserverBehavior: RouteObserverBehavior, | 329 RouteObserverBehavior: RouteObserverBehavior, |
| 329 getRouteForPath: getRouteForPath, | 330 getRouteForPath: getRouteForPath, |
| 330 initializeRouteFromUrl: initializeRouteFromUrl, | 331 initializeRouteFromUrl: initializeRouteFromUrl, |
| 331 getCurrentRoute: getCurrentRoute, | 332 getCurrentRoute: getCurrentRoute, |
| 332 getQueryParameters: getQueryParameters, | 333 getQueryParameters: getQueryParameters, |
| 333 navigateTo: navigateTo, | 334 navigateTo: navigateTo, |
| 334 }; | 335 }; |
| 335 }); | 336 }); |
| OLD | NEW |