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

Side by Side Diff: tracing/tracing/value/ui/date_range_span.html

Issue 3002973002: Refactor diagnostic spans to share a polymer behavior. (Closed)
Patch Set: Created 3 years, 4 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 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright 2017 The Chromium Authors. All rights reserved. 3 Copyright 2017 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 7
8 <link rel="import" href="/tracing/ui/base/base.html"> 8 <link rel="import" href="/tracing/value/ui/diagnostic_span_behavior.html">
9 9
10 <dom-module id="tr-v-ui-date-range-span"> 10 <dom-module id="tr-v-ui-date-range-span">
11 <template> 11 <template>
12 <content></content> 12 <content></content>
13 </template> 13 </template>
14 </dom-module>
14 15
15 <script> 16 <script>
16 'use strict'; 17 'use strict';
18 tr.exportTo('tr.v.ui', function() {
17 Polymer({ 19 Polymer({
18 is: 'tr-v-ui-date-range-span', 20 is: 'tr-v-ui-date-range-span',
19 21 behaviors: [tr.v.ui.DIAGNOSTIC_SPAN_BEHAVIOR],
20 ready() {
21 this.diagnostic_ = undefined;
22 },
23
24 get diagnostic() {
25 return this.diagnostic_;
26 },
27
28 set diagnostic(d) {
29 this.diagnostic_ = d;
30 this.updateContents_();
31 },
32 22
33 updateContents_() { 23 updateContents_() {
34 if (this.diagnostic === undefined) { 24 if (this.diagnostic === undefined) {
35 this.textContent = ''; 25 Polymer.dom(this).textContent = '';
36 return; 26 return;
37 } 27 }
38 28
39 this.textContent = this.diagnostic.toString(); 29 Polymer.dom(this).textContent = this.diagnostic.toString();
40 } 30 }
41 }); 31 });
42 </script> 32
43 </dom-module> 33 return {};
34 });
35 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698