| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 _addToBrowserHistory(url); | 108 _addToBrowserHistory(url); |
| 109 } | 109 } |
| 110 _updateApplicationLocation(url); | 110 _updateApplicationLocation(url); |
| 111 _visit(); | 111 _visit(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 /// Starting with the current uri path and queryParameters, update | 114 /// Starting with the current uri path and queryParameters, update |
| 115 /// queryParameters present in [updateParameters], then generate a new uri | 115 /// queryParameters present in [updateParameters], then generate a new uri |
| 116 /// and navigate to that. | 116 /// and navigate to that. |
| 117 goReplacingParameters(Map updatedParameters, [bool addToBrowserHistory = true]
) { | 117 goReplacingParameters(Map updatedParameters, [bool addToBrowserHistory = true]
) { |
| 118 go(makeLinkReplacingParameter(updatedParameters), addToBrowserHistory); | 118 go(makeLinkReplacingParameters(updatedParameters), addToBrowserHistory); |
| 119 } | 119 } |
| 120 | 120 |
| 121 makeLinkReplacingParameters(Map updatedParameters) { | 121 makeLinkReplacingParameters(Map updatedParameters) { |
| 122 var parameters = new Map.from(_uri.queryParameters); | 122 var parameters = new Map.from(_uri.queryParameters); |
| 123 updatedParameters.forEach((k, v) { | 123 updatedParameters.forEach((k, v) { |
| 124 parameters[k] = v; | 124 parameters[k] = v; |
| 125 }); | 125 }); |
| 126 // Ensure path starts with a slash. | 126 // Ensure path starts with a slash. |
| 127 var path = uri.path.startsWith('/') ? uri.path : '/${uri.path}'; | 127 var path = uri.path.startsWith('/') ? uri.path : '/${uri.path}'; |
| 128 var generatedUri = new Uri(path: path, queryParameters: parameters); | 128 var generatedUri = new Uri(path: path, queryParameters: parameters); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 151 // let browser handle. | 151 // let browser handle. |
| 152 return; | 152 return; |
| 153 } | 153 } |
| 154 event.preventDefault(); | 154 event.preventDefault(); |
| 155 // 'currentTarget' is the dom element that would process the event. | 155 // 'currentTarget' is the dom element that would process the event. |
| 156 // If we use 'target' we might get an <em> element or somesuch. | 156 // If we use 'target' we might get an <em> element or somesuch. |
| 157 var target = event.currentTarget; | 157 var target = event.currentTarget; |
| 158 go(target.attributes['href']); | 158 go(target.attributes['href']); |
| 159 } | 159 } |
| 160 } | 160 } |
| OLD | NEW |