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

Side by Side Diff: third_party/pkg/route_hierarchical/lib/client.dart

Issue 256553002: Revert "Update all Angular libs (run update_all.sh)." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library route.client; 5 library route.client;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 9
10 import 'package:logging/logging.dart'; 10 import 'package:logging/logging.dart';
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 currentRoute.dontLeaveOnParamChanges && 510 currentRoute.dontLeaveOnParamChanges &&
511 identical(currentRoute, treePath.last.route)) { 511 identical(currentRoute, treePath.last.route)) {
512 return new Future.value(true); 512 return new Future.value(true);
513 } 513 }
514 514
515 var event = new RouteLeaveEvent('', {}, startingFrom); 515 var event = new RouteLeaveEvent('', {}, startingFrom);
516 return _leaveCurrentRoute(startingFrom, event); 516 return _leaveCurrentRoute(startingFrom, event);
517 } 517 }
518 518
519 List _matchingRoutes(String path, RouteImpl baseRoute) { 519 List _matchingRoutes(String path, RouteImpl baseRoute) {
520 var routes = baseRoute._routes.values 520 var routes = baseRoute._routes.values.toList();
521 .where((r) => r.path.match(path) != null) 521 if (sortRoutes) {
522 .toList(); 522 routes.sort((r1, r2) => r1.path.compareTo(r2.path));
523 523 }
524 return sortRoutes ? 524 return routes.where((r) => r.path.match(path) != null).toList();
525 (routes..sort((r1, r2) => r1.path.compareTo(r2.path))) : routes;
526 } 525 }
527 526
528 List<_Match> _matchingTreePath(String path, RouteImpl baseRoute) { 527 List<_Match> _matchingTreePath(String path, RouteImpl baseRoute) {
529 final treePath = <_Match>[]; 528 final treePath = <_Match>[];
530 Route matchedRoute; 529 Route matchedRoute;
531 do { 530 do {
532 matchedRoute = null; 531 matchedRoute = null;
533 List matchingRoutes = _matchingRoutes(path, baseRoute); 532 List matchingRoutes = _matchingRoutes(path, baseRoute);
534 if (matchingRoutes.isNotEmpty) { 533 if (matchingRoutes.isNotEmpty) {
535 if (matchingRoutes.length > 1) { 534 if (matchingRoutes.length > 1) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 queryStr.split('&').forEach((String keyValPair) { 605 queryStr.split('&').forEach((String keyValPair) {
607 List<String> keyVal = _parseKeyVal(keyValPair); 606 List<String> keyVal = _parseKeyVal(keyValPair);
608 if (keyVal[0].startsWith('${route.name}.')) { 607 if (keyVal[0].startsWith('${route.name}.')) {
609 var key = keyVal[0].substring('${route.name}.'.length); 608 var key = keyVal[0].substring('${route.name}.'.length);
610 if (key.isNotEmpty) params[key] = Uri.decodeComponent(keyVal[1]); 609 if (key.isNotEmpty) params[key] = Uri.decodeComponent(keyVal[1]);
611 } 610 }
612 }); 611 });
613 return params; 612 return params;
614 } 613 }
615 614
616 List<String> _parseKeyVal(kvPair) { 615 List<String> _parseKeyVal(keyValPair) {
617 if (kvPair.isEmpty) { 616 if (keyValPair.isEmpty) return const ['', ''];
618 return const ['', '']; 617 var splitPoint = keyValPair.indexOf('=') == -1 ?
619 } 618 keyValPair.length : keyValPair.indexOf('=') + 1;
620 var splitPoint = kvPair.indexOf('='); 619 var key = keyValPair.substring(0, splitPoint +
621 620 (keyValPair.indexOf('=') == -1 ? 0 : -1));
622 return (splitPoint == -1) ? 621 var value = keyValPair.substring(splitPoint);
623 [kvPair, ''] 622 return [key, value];
624 : [kvPair.substring(0, splitPoint), kvPair.substring(splitPoint + 1)];
625 } 623 }
626 624
627 void _unsetAllCurrentRoutes(RouteImpl r) { 625 void _unsetAllCurrentRoutes(RouteImpl r) {
628 if (r._currentRoute != null) { 626 if (r._currentRoute != null) {
629 _unsetAllCurrentRoutes(r._currentRoute); 627 _unsetAllCurrentRoutes(r._currentRoute);
630 r._currentRoute = null; 628 r._currentRoute = null;
631 } 629 }
632 } 630 }
633 631
634 Future<bool> _leaveCurrentRoute(RouteImpl base, RouteLeaveEvent e) => 632 Future<bool> _leaveCurrentRoute(RouteImpl base, RouteLeaveEvent e) =>
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 */ 748 */
751 Route findRoute(String routePath) => root.findRoute(routePath); 749 Route findRoute(String routePath) => root.findRoute(routePath);
752 } 750 }
753 751
754 class _Match { 752 class _Match {
755 final RouteImpl route; 753 final RouteImpl route;
756 final UrlMatch urlMatch; 754 final UrlMatch urlMatch;
757 755
758 _Match(this.route, this.urlMatch); 756 _Match(this.route, this.urlMatch);
759 } 757 }
OLDNEW
« no previous file with comments | « third_party/pkg/route_hierarchical/REVISION ('k') | third_party/pkg/route_hierarchical/lib/pattern.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698