| 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 15 matching lines...) Expand all Loading... |
| 26 if (_lastUrl != url) { | 26 if (_lastUrl != url) { |
| 27 Logger.root.info('Navigated to ${url}'); | 27 Logger.root.info('Navigated to ${url}'); |
| 28 window.history.pushState(url, document.title, url); | 28 window.history.pushState(url, document.title, url); |
| 29 _lastUrl = url; | 29 _lastUrl = url; |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 | 32 |
| 33 /// Go to a specific url. | 33 /// Go to a specific url. |
| 34 void go(String url) { | 34 void go(String url) { |
| 35 if (_app.vm == null) { | 35 if (_app.vm == null) { |
| 36 if (!window.confirm('Connection with VM has been lost. ' |
| 37 'Proceeding will lose current page.')) { |
| 38 return; |
| 39 } |
| 36 url = makeLink('/vm-connect/'); | 40 url = makeLink('/vm-connect/'); |
| 37 } | 41 } |
| 38 _pushUrl(url); | 42 _pushUrl(url); |
| 39 _go(url); | 43 _go(url); |
| 40 } | 44 } |
| 41 | 45 |
| 42 void _go(String url) { | 46 void _go(String url) { |
| 43 // Chop off leading '#'. | 47 // Chop off leading '#'. |
| 44 if (url.startsWith('#')) { | 48 if (url.startsWith('#')) { |
| 45 url = url.substring(1); | 49 url = url.substring(1); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 _go(window.location.pathname); | 128 _go(window.location.pathname); |
| 125 } | 129 } |
| 126 | 130 |
| 127 void _onLocationChange(PopStateEvent _) { | 131 void _onLocationChange(PopStateEvent _) { |
| 128 _go(window.location.pathname); | 132 _go(window.location.pathname); |
| 129 } | 133 } |
| 130 | 134 |
| 131 /// Given an application url, generate a link for an anchor tag. | 135 /// Given an application url, generate a link for an anchor tag. |
| 132 String makeLink(String url) => url; | 136 String makeLink(String url) => url; |
| 133 } | 137 } |
| OLD | NEW |