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 class LocationManager extends Observable { | 7 class LocationManager extends Observable { |
8 final _defaultPath = '/vm'; | 8 final _defaultPath = '/vm'; |
9 | 9 |
10 final ObservatoryApplication _app; | 10 final ObservatoryApplication _app; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 /// Notify the current page that something has changed. | 92 /// Notify the current page that something has changed. |
93 _visit() { | 93 _visit() { |
94 runZoned(() => _app._visit(_uri, internalArguments), | 94 runZoned(() => _app._visit(_uri, internalArguments), |
95 onError: (e, st) { | 95 onError: (e, st) { |
96 if (e is IsolateNotFound) { | 96 if (e is IsolateNotFound) { |
97 var newPath = ((_app.vm == null || _app.vm.isDisconnected) | 97 var newPath = ((_app.vm == null || _app.vm.isDisconnected) |
98 ? '/vm-connect' : '/isolate-reconnect'); | 98 ? '/vm-connect' : '/isolate-reconnect'); |
99 var parameters = {}; | 99 var parameters = {}; |
100 parameters.addAll(_uri.queryParameters); | 100 parameters.addAll(_uri.queryParameters); |
101 parameters['originalPath'] = _uri.path; | 101 parameters['originalUri'] = _uri.toString(); |
102 parameters['originalIsolateId'] = parameters['isolateId']; | 102 parameters['isolateId'] = parameters['isolateId']; |
103 var generatedUri = new Uri(path: newPath, queryParameters: parameters); | 103 var generatedUri = new Uri(path: newPath, queryParameters: parameters); |
104 go(makeLink(generatedUri.toString()), true); | 104 go(makeLink(generatedUri.toString()), true); |
105 return; | 105 return; |
106 } | 106 } |
107 // Surface any uncaught exceptions. | 107 // Surface any uncaught exceptions. |
108 _app.handleException(e, st); | 108 _app.handleException(e, st); |
109 }); | 109 }); |
110 } | 110 } |
111 | 111 |
112 /// Navigate to [url]. | 112 /// Navigate to [url]. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // let browser handle. | 167 // let browser handle. |
168 return; | 168 return; |
169 } | 169 } |
170 event.preventDefault(); | 170 event.preventDefault(); |
171 // 'currentTarget' is the dom element that would process the event. | 171 // 'currentTarget' is the dom element that would process the event. |
172 // If we use 'target' we might get an <em> element or somesuch. | 172 // If we use 'target' we might get an <em> element or somesuch. |
173 var target = event.currentTarget; | 173 var target = event.currentTarget; |
174 go(target.attributes['href']); | 174 go(target.attributes['href']); |
175 } | 175 } |
176 } | 176 } |
OLD | NEW |