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

Side by Side Diff: runtime/observatory/lib/src/elements/nav/library_menu.dart

Issue 2310003004: Removed polymer & mirror from Observatory (Closed)
Patch Set: Fixed crash in heap-map page Created 4 years, 3 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'dart:html'; 5 import 'dart:html';
6 import 'dart:async'; 6 import 'dart:async';
7 import 'package:observatory/models.dart' as M show IsolateRef, LibraryRef; 7 import 'package:observatory/models.dart' as M show IsolateRef, LibraryRef;
8 import 'package:observatory/src/elements/helpers/nav_menu.dart';
8 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; 9 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
9 import 'package:observatory/src/elements/helpers/tag.dart'; 10 import 'package:observatory/src/elements/helpers/tag.dart';
10 import 'package:observatory/src/elements/helpers/uris.dart'; 11 import 'package:observatory/src/elements/helpers/uris.dart';
11 import 'package:observatory/src/elements/nav/menu.dart';
12 12
13 class NavLibraryMenuElement extends HtmlElement implements Renderable { 13 class NavLibraryMenuElement extends HtmlElement implements Renderable {
14 static const tag = const Tag<NavLibraryMenuElement>('nav-library-menu', 14 static const tag = const Tag<NavLibraryMenuElement>('nav-library-menu');
15 dependencies: const [NavMenuElement.tag]);
16 15
17 RenderingScheduler _r; 16 RenderingScheduler _r;
18 17
19 Stream<RenderedEvent<NavLibraryMenuElement>> get onRendered => _r.onRendered; 18 Stream<RenderedEvent<NavLibraryMenuElement>> get onRendered => _r.onRendered;
20 19
21 bool _last;
22 M.IsolateRef _isolate; 20 M.IsolateRef _isolate;
23 M.LibraryRef _library; 21 M.LibraryRef _library;
22 Iterable<Element> _content = const [];
24 23
25 bool get last => _last;
26 M.IsolateRef get isolate => _isolate; 24 M.IsolateRef get isolate => _isolate;
27 M.LibraryRef get library => _library; 25 M.LibraryRef get library => _library;
28 26 Iterable<Element> get content => _content;
29 set last(bool value) => _last = _r.checkAndReact(_last, value); 27
28 set content(Iterable<Element> value) {
29 _content = value.toList();
30 _r.dirty();
31 }
30 32
31 factory NavLibraryMenuElement(M.IsolateRef isolate, M.LibraryRef library, 33 factory NavLibraryMenuElement(M.IsolateRef isolate, M.LibraryRef library,
32 {bool last: false, RenderingQueue queue}) { 34 {RenderingQueue queue}) {
33 assert(isolate != null); 35 assert(isolate != null);
34 assert(library != null); 36 assert(library != null);
35 assert(last != null);
36 NavLibraryMenuElement e = document.createElement(tag.name); 37 NavLibraryMenuElement e = document.createElement(tag.name);
37 e._r = new RenderingScheduler(e, queue: queue); 38 e._r = new RenderingScheduler(e, queue: queue);
38 e._isolate = isolate; 39 e._isolate = isolate;
39 e._library = library; 40 e._library = library;
40 e._last = last;
41 return e; 41 return e;
42 } 42 }
43 43
44 NavLibraryMenuElement.created() : super.created() { createShadowRoot(); } 44 NavLibraryMenuElement.created() : super.created();
45 45
46 @override 46 @override
47 void attached() { 47 void attached() {
48 super.attached(); 48 super.attached();
49 _r.enable(); 49 _r.enable();
50 } 50 }
51 51
52 @override 52 @override
53 void detached() { 53 void detached() {
54 super.detached(); 54 super.detached();
55 children = [];
55 _r.disable(notify: true); 56 _r.disable(notify: true);
56 shadowRoot.children = [];
57 } 57 }
58 58
59 void render() { 59 void render() {
60 shadowRoot.children = [ 60 children = [
61 new NavMenuElement(library.name, last: last, queue: _r.queue, 61 navMenu(library.name, content: _content,
62 link: Uris.inspect(isolate, object: library).toString()) 62 link: Uris.inspect(isolate, object: library).toString())
63 ..children = [new ContentElement()]
64 ]; 63 ];
65 } 64 }
66 } 65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698