Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Side by Side Diff: runtime/bin/vmservice/client/lib/src/observatory_elements/script_ref.dart

Issue 165643003: Rework <script-ref>: - optional 'line' parameter - use a shorter version of the script url in the a… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: gen js Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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;
13
14 String get url {
15 if ((app != null) && (ref != null)) {
16 var baseUrl = relativeLink(ref['id']);
17 if (line < 0) {
18 return baseUrl;
19 } else {
20 return '$baseUrl?line=$line';
21 }
22 }
23 return '';
24 }
25
26 String get hoverText {
27 if (ref == null) {
28 return '';
29 }
30 if (line < 0) {
31 return ref['user_name'];
32 } else {
33 return "${ref['user_name']}:$line";
34 }
35 }
36
37 String get name {
38 if (ref == null) {
39 return '';
40 }
41 var scriptUrl = ref['user_name'];
42 var shortScriptUrl = scriptUrl.substring(scriptUrl.lastIndexOf('/') + 1);
43 if (line < 0) {
44 return shortScriptUrl;
45 } else {
46 return "$shortScriptUrl:$line";
47 }
48 }
49
12 ScriptRefElement.created() : super.created(); 50 ScriptRefElement.created() : super.created();
13 } 51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698