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 observatory; | 5 part of observatory; |
6 | 6 |
7 /// The LocationManager class observes and parses the hash ('#') portion of the | 7 /// The LocationManager class observes and parses the hash ('#') portion of the |
8 /// URL in window.location. The text after the '#' is used as the request | 8 /// URL in window.location. The text after the '#' is used as the request |
9 /// string for the VM service. | 9 /// string for the VM service. |
10 class LocationManager extends Observable { | 10 class LocationManager extends Observable { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 /// if none is present in window.location. | 58 /// if none is present in window.location. |
59 String currentIsolateId() { | 59 String currentIsolateId() { |
60 var prefix = currentIsolateAnchorPrefix(); | 60 var prefix = currentIsolateAnchorPrefix(); |
61 if (prefix == null) { | 61 if (prefix == null) { |
62 return ''; | 62 return ''; |
63 } | 63 } |
64 // Chop off the '/#'. | 64 // Chop off the '/#'. |
65 return prefix.substring(2); | 65 return prefix.substring(2); |
66 } | 66 } |
67 | 67 |
68 Isolate currentIsolate() { | 68 @observable Isolate currentIsolate() { |
69 var id = currentIsolateId(); | 69 var id = currentIsolateId(); |
70 if (id == '') { | 70 if (id == '') { |
71 return null; | 71 return null; |
72 } | 72 } |
73 return _application.isolateManager.getIsolate(id); | 73 return _application.isolateManager.getIsolate(id); |
74 } | 74 } |
75 | 75 |
76 /// If no anchor is set, set the default anchor and return true. | 76 /// If no anchor is set, set the default anchor and return true. |
77 /// Return false otherwise. | 77 /// Return false otherwise. |
78 bool setDefaultHash() { | 78 bool setDefaultHash() { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 String relativeLink(String isolateId, String l) { | 122 String relativeLink(String isolateId, String l) { |
123 return '#/$isolateId/$l'; | 123 return '#/$isolateId/$l'; |
124 } | 124 } |
125 | 125 |
126 /// Create a request for [l] on [isolateId]. | 126 /// Create a request for [l] on [isolateId]. |
127 @observable | 127 @observable |
128 String absoluteLink(String l) { | 128 String absoluteLink(String l) { |
129 return '#/$l'; | 129 return '#/$l'; |
130 } | 130 } |
131 } | 131 } |
OLD | NEW |