Chromium Code Reviews| 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 library script_ref_element; | 5 library script_ref_element; |
| 6 | 6 |
| 7 import 'package:polymer/polymer.dart'; | 7 import 'package:polymer/polymer.dart'; |
| 8 import 'service_ref.dart'; | 8 import 'service_ref.dart'; |
| 9 | 9 |
| 10 @CustomTag('script-ref') | 10 @CustomTag('script-ref') |
| 11 class ScriptRefElement extends ServiceRefElement { | 11 class ScriptRefElement extends ServiceRefElement { |
| 12 @published int line = -1; | 12 @published int line = -1; |
| 13 | 13 |
| 14 String get objectId { | |
| 15 if (line < 0) { | |
| 16 return super.objectId; | |
| 17 } | |
| 18 // TODO(johnmccutchan): Add a ?line=XX invalidates the idea that this | |
| 19 // method returns an objectId. | |
| 20 return '${super.objectId}?line=$line'; | |
| 21 } | |
| 22 | |
| 23 String get hoverText { | 14 String get hoverText { |
| 24 if (ref == null) { | 15 if (ref == null) { |
| 25 return ''; | 16 return super.hoverText; |
| 26 } | 17 } |
| 27 if (line < 0) { | 18 if (line < 0) { |
| 28 return ref['user_name']; | 19 return ref.vmName; |
| 29 } else { | 20 } else { |
| 30 return "${ref['user_name']}:$line"; | 21 return '${ref.vmName}:$line'; |
| 31 } | 22 } |
| 32 } | 23 } |
| 33 | 24 |
| 34 String get name { | 25 String get name { |
|
turnidge
2014/03/10 21:03:28
I'm beginning to wonder if it makes sense to have
Cutch
2014/03/11 03:17:48
Agreed. Let's discuss how we can make generating d
| |
| 35 if (ref == null) { | 26 if (ref == null) { |
| 36 return ''; | 27 return super.name; |
| 37 } | 28 } |
| 38 var scriptUrl = ref['user_name']; | |
| 39 var shortScriptUrl = scriptUrl.substring(scriptUrl.lastIndexOf('/') + 1); | |
| 40 if (line < 0) { | 29 if (line < 0) { |
| 41 return shortScriptUrl; | 30 return ref.name; |
| 42 } else { | 31 } else { |
| 43 return "$shortScriptUrl:$line"; | 32 return '${ref.name}:$line'; |
| 44 } | 33 } |
| 45 } | 34 } |
| 46 | 35 |
| 47 ScriptRefElement.created() : super.created(); | 36 ScriptRefElement.created() : super.created(); |
| 48 } | 37 } |
| OLD | NEW |