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

Side by Side Diff: runtime/observatory/lib/src/elements/nav/refresh.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/src/elements/helpers/tag.dart'; 7 import 'package:observatory/src/elements/helpers/tag.dart';
8 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; 8 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
9 9
10 class RefreshEvent { 10 class RefreshEvent {
11 final NavRefreshElement element; 11 final NavRefreshElement element;
12 RefreshEvent(this.element); 12 RefreshEvent(this.element);
13 } 13 }
14 14
15 class NavRefreshElement extends HtmlElement implements Renderable { 15 class NavRefreshElement extends HtmlElement implements Renderable {
16 static const tag = const Tag<NavRefreshElement>('nav-refresh-wrapped'); 16 static const tag = const Tag<NavRefreshElement>('nav-refresh');
17 17
18 RenderingScheduler _r; 18 RenderingScheduler _r;
19 19
20 Stream<RenderedEvent<NavRefreshElement>> get onRendered => _r.onRendered; 20 Stream<RenderedEvent<NavRefreshElement>> get onRendered => _r.onRendered;
21 21
22 final StreamController<RefreshEvent> _onRefresh = 22 final StreamController<RefreshEvent> _onRefresh =
23 new StreamController<RefreshEvent>.broadcast(); 23 new StreamController<RefreshEvent>.broadcast();
24 Stream<RefreshEvent> get onRefresh => _onRefresh.stream; 24 Stream<RefreshEvent> get onRefresh => _onRefresh.stream;
25 25
26 bool _disabled; 26 bool _disabled;
27 String _label; 27 String _label;
28 28
29 bool get disabled => _disabled; 29 bool get disabled => _disabled;
30 String get label => _label; 30 String get label => _label;
31 31
32 set disabled(bool value) => _disabled = _r.checkAndReact(_disabled, value); 32 set disabled(bool value) => _disabled = _r.checkAndReact(_disabled, value);
33 set label(String value) => _label = _r.checkAndReact(_label, value); 33 set label(String value) => _label = _r.checkAndReact(_label, value);
34 34
35 factory NavRefreshElement({String label: 'Refresh', bool disabled: false, 35 factory NavRefreshElement({String label: 'Refresh', bool disabled: false,
36 RenderingQueue queue}) { 36 RenderingQueue queue}) {
37 assert(label != null); 37 assert(label != null);
38 assert(disabled != null); 38 assert(disabled != null);
39 NavRefreshElement e = document.createElement(tag.name); 39 NavRefreshElement e = document.createElement(tag.name);
40 e._r = new RenderingScheduler(e, queue: queue); 40 e._r = new RenderingScheduler(e, queue: queue);
41 e._label = label; 41 e._label = label;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 void _refresh(RefreshEvent e) { 77 void _refresh(RefreshEvent e) {
78 if (_disabled) return; 78 if (_disabled) return;
79 _onRefresh.add(e); 79 _onRefresh.add(e);
80 } 80 }
81 81
82 void refresh() { 82 void refresh() {
83 if (_disabled) return; 83 if (_disabled) return;
84 _refresh(new RefreshEvent(this)); 84 _refresh(new RefreshEvent(this));
85 } 85 }
86 } 86 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698