| OLD | NEW |
| 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 part of app; | 5 part of app; |
| 6 | 6 |
| 7 abstract class LocationManager extends Observable { | 7 abstract class LocationManager extends Observable { |
| 8 final _initialPath = '/vm'; | 8 final _initialPath = '/vm'; |
| 9 ObservatoryApplication _app; | 9 ObservatoryApplication _app; |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 void _go(String url) { | 35 void _go(String url) { |
| 36 // Chop off leading '#'. | 36 // Chop off leading '#'. |
| 37 if (url.startsWith('#')) { | 37 if (url.startsWith('#')) { |
| 38 url = url.substring(1); | 38 url = url.substring(1); |
| 39 } | 39 } |
| 40 // Fall through handles '#/' | 40 // Fall through handles '#/' |
| 41 // Chop off leading '/'. | 41 // Chop off leading '/'. |
| 42 if (url.startsWith('/')) { | 42 if (url.startsWith('/')) { |
| 43 url = url.substring(1); | 43 url = url.substring(1); |
| 44 } | 44 } |
| 45 _app._visit(url); | 45 var args; |
| 46 // Parse out arguments. |
| 47 if (url.contains('#')) { |
| 48 var chunks = url.split('#'); |
| 49 url = chunks[0]; |
| 50 if ((chunks.length > 1) && (chunks[1] != '')) { |
| 51 args = chunks[1]; |
| 52 } |
| 53 } |
| 54 _app._visit(url, args); |
| 46 } | 55 } |
| 47 | 56 |
| 48 /// Go back. | 57 /// Go back. |
| 49 void back() { | 58 void back() { |
| 50 window.history.go(-1); | 59 window.history.go(-1); |
| 51 } | 60 } |
| 52 | 61 |
| 53 /// Go forward. | 62 /// Go forward. |
| 54 void forward() { | 63 void forward() { |
| 55 window.history.go(1); | 64 window.history.go(1); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 _go(window.location.pathname); | 117 _go(window.location.pathname); |
| 109 } | 118 } |
| 110 | 119 |
| 111 void _onLocationChange(PopStateEvent _) { | 120 void _onLocationChange(PopStateEvent _) { |
| 112 _go(window.location.pathname); | 121 _go(window.location.pathname); |
| 113 } | 122 } |
| 114 | 123 |
| 115 /// Given an application url, generate a link for an anchor tag. | 124 /// Given an application url, generate a link for an anchor tag. |
| 116 String makeLink(String url) => url; | 125 String makeLink(String url) => url; |
| 117 } | 126 } |
| OLD | NEW |