| 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 14 matching lines...) Expand all Loading... |
| 25 void _pushUrl(String url) { | 25 void _pushUrl(String url) { |
| 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 ((url != makeLink('/vm-connect/')) && _app.vm == null) { |
| 36 if (!window.confirm('Connection with VM has been lost. ' | 36 if (!window.confirm('Connection with VM has been lost. ' |
| 37 'Proceeding will lose current page.')) { | 37 'Proceeding will lose current page.')) { |
| 38 return; | 38 return; |
| 39 } | 39 } |
| 40 url = makeLink('/vm-connect/'); | 40 url = makeLink('/vm-connect/'); |
| 41 } | 41 } |
| 42 _pushUrl(url); | 42 _pushUrl(url); |
| 43 _go(url); | 43 _go(url); |
| 44 } | 44 } |
| 45 | 45 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 _go(window.location.pathname); | 128 _go(window.location.pathname); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void _onLocationChange(PopStateEvent _) { | 131 void _onLocationChange(PopStateEvent _) { |
| 132 _go(window.location.pathname); | 132 _go(window.location.pathname); |
| 133 } | 133 } |
| 134 | 134 |
| 135 /// Given an application url, generate a link for an anchor tag. | 135 /// Given an application url, generate a link for an anchor tag. |
| 136 String makeLink(String url) => url; | 136 String makeLink(String url) => url; |
| 137 } | 137 } |
| OLD | NEW |