| 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 * Helper function to set the current route and notify all observers. | 305 * Helper function to set the current route and notify all observers. |
| 306 * @param {!settings.Route} route | 306 * @param {!settings.Route} route |
| 307 * @param {!URLSearchParams} queryParameters | 307 * @param {!URLSearchParams} queryParameters |
| 308 * @param {boolean} isPopstate | 308 * @param {boolean} isPopstate |
| 309 */ | 309 */ |
| 310 var setCurrentRoute = function(route, queryParameters, isPopstate) { | 310 var setCurrentRoute = function(route, queryParameters, isPopstate) { |
| 311 var oldRoute = currentRoute_; | 311 var oldRoute = currentRoute_; |
| 312 currentRoute_ = route; | 312 currentRoute_ = route; |
| 313 currentQueryParameters_ = queryParameters; | 313 currentQueryParameters_ = queryParameters; |
| 314 lastRouteChangeWasPopstate_ = isPopstate; | 314 lastRouteChangeWasPopstate_ = isPopstate; |
| 315 for (var observer of routeObservers_) | 315 routeObservers_.forEach(function(observer) { |
| 316 observer.currentRouteChanged(currentRoute_, oldRoute); | 316 observer.currentRouteChanged(currentRoute_, oldRoute); |
| 317 }); |
| 317 }; | 318 }; |
| 318 | 319 |
| 319 /** @return {!settings.Route} */ | 320 /** @return {!settings.Route} */ |
| 320 var getCurrentRoute = function() { return currentRoute_; }; | 321 var getCurrentRoute = function() { return currentRoute_; }; |
| 321 | 322 |
| 322 /** @return {!URLSearchParams} */ | 323 /** @return {!URLSearchParams} */ |
| 323 var getQueryParameters = function() { | 324 var getQueryParameters = function() { |
| 324 return new URLSearchParams(currentQueryParameters_); // Defensive copy. | 325 return new URLSearchParams(currentQueryParameters_); // Defensive copy. |
| 325 }; | 326 }; |
| 326 | 327 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 RouteObserverBehavior: RouteObserverBehavior, | 385 RouteObserverBehavior: RouteObserverBehavior, |
| 385 getRouteForPath: getRouteForPath, | 386 getRouteForPath: getRouteForPath, |
| 386 initializeRouteFromUrl: initializeRouteFromUrl, | 387 initializeRouteFromUrl: initializeRouteFromUrl, |
| 387 getCurrentRoute: getCurrentRoute, | 388 getCurrentRoute: getCurrentRoute, |
| 388 getQueryParameters: getQueryParameters, | 389 getQueryParameters: getQueryParameters, |
| 389 lastRouteChangeWasPopstate: lastRouteChangeWasPopstate, | 390 lastRouteChangeWasPopstate: lastRouteChangeWasPopstate, |
| 390 navigateTo: navigateTo, | 391 navigateTo: navigateTo, |
| 391 navigateToPreviousRoute: navigateToPreviousRoute, | 392 navigateToPreviousRoute: navigateToPreviousRoute, |
| 392 }; | 393 }; |
| 393 }); | 394 }); |
| OLD | NEW |