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 isolate_ref_element; | 5 library isolate_ref_element; |
| 6 | 6 |
| 7 import 'package:polymer/polymer.dart'; | 7 import 'dart:html'; |
| 8 import 'service_ref.dart'; | 8 import 'package:observatory/service_html.dart'; |
| 9 import 'helpers/tag.dart'; | |
| 9 | 10 |
| 10 @CustomTag('isolate-ref') | 11 class IsolateRefElement extends HtmlElement { |
| 11 class IsolateRefElement extends ServiceRefElement { | 12 static final StyleElement _style = () { |
| 12 IsolateRefElement.created() : super.created(); | 13 var style = new StyleElement(); |
| 14 style.text = 'a {' | |
| 15 ' color: #0489c3;' | |
| 16 ' text-decoration: none;' | |
| 17 '}' | |
| 18 'a:hover {' | |
| 19 ' text-decoration: underline;' | |
| 20 '}'; | |
| 21 return style; | |
| 22 }(); | |
| 23 | |
| 24 static const tag = const Tag<IsolateRefElement>('isolate-ref-wrapped'); | |
| 25 | |
| 26 Isolate isolate; | |
| 27 | |
| 28 factory IsolateRefElement({Isolate isolate}) { | |
| 29 IsolateRefElement e = document.createElement(tag.name); | |
| 30 e.isolate = isolate; | |
| 31 return e; | |
| 32 } | |
| 33 | |
| 34 IsolateRefElement.created() : super.created() { | |
| 35 createShadowRoot(); | |
| 36 } | |
| 37 | |
| 38 @override | |
| 39 void attached() { | |
| 40 super.attached(); | |
| 41 render(); | |
| 42 } | |
| 43 | |
| 44 void render() { | |
| 45 shadowRoot.children = []; | |
| 46 if (isolate == null) return; | |
| 47 | |
| 48 shadowRoot.children = [ | |
| 49 _style.clone(true), | |
| 50 new AnchorElement(href: | |
| 51 '#/inspect?isolateId=${Uri.encodeComponent(isolate.id)}') | |
|
Cutch
2016/07/01 17:33:36
We should probably delegate the href building to s
| |
| 52 ..text = 'Isolate ${isolate.number} (${isolate.name})' | |
| 53 ]; | |
| 54 } | |
| 13 } | 55 } |
| OLD | NEW |