1<!DOCTYPE html> 2<!-- 3Copyright (c) 2013 The Chromium Authors. All rights reserved. 4Use of this source code is governed by a BSD-style license that can be 5found in the LICENSE file. 6--> 7 8<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html"> 9<link rel="import" href="/tracing/ui/analysis/single_event_sub_view.html"> 10<link rel="import" href="/tracing/ui/analysis/related_events.html"> 11 12<polymer-element name="tr-ui-a-single-async-slice-sub-view" 13 extends="tr-ui-a-sub-view"> 14 <template> 15 <style> 16 :host { 17 display: flex; 18 flex-direction: row; 19 } 20 #events { 21 display:flex; 22 flex-direction: column; 23 } 24 </style> 25 <tr-ui-a-single-event-sub-view id="content"></tr-ui-a-single-event-sub-view> 26 <div id="events"> 27 <tr-ui-a-related-events id="relatedEvents"></tr-ui-a-related-events> 28 </div> 29 </template> 30 31 <script> 32 'use strict'; 33 34 Polymer({ 35 get selection() { 36 return this.$.content.selection; 37 }, 38 39 set selection(selection) { 40 if (selection.length !== 1) 41 throw new Error('Only supports single slices'); 42 this.$.content.setSelectionWithoutErrorChecks(selection); 43 this.$.relatedEvents.setRelatedEvents(selection); 44 if (this.$.relatedEvents.hasRelatedEvents()) { 45 this.$.relatedEvents.style.display = ''; 46 } else { 47 this.$.relatedEvents.style.display = 'none'; 48 } 49 }, 50 51 getEventRows_: function(event) { 52 // TODO(nduca): Figure out if there is a cleaner way to do this. 53 var rows = this.__proto__.__proto__.getEventRows_(event); 54 55 // Put the ID up top. 56 rows.splice(0, 0, { 57 name: 'ID', 58 value: event.id 59 }); 60 return rows; 61 }, 62 63 get relatedEventsToHighlight() { 64 if (!this.currentSelection_) 65 return undefined; 66 return this.currentSelection_[0].associatedEvents; 67 } 68 }); 69 </script> 70</polymer-element> 71