1<!DOCTYPE html>
2<!--
3Copyright (c) 2015 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/alert_sub_view.html">
10
11<polymer-element name="tr-ui-a-single-frame-sub-view"
12    extends="tr-ui-a-sub-view">
13  <template>
14    <style>
15    :host {
16      display: flex;
17      flex-direction: column;
18    }
19    #asv {
20      flex: 0 0 auto;
21      align-self: stretch;
22    }
23    </style>
24    <tr-ui-a-alert-sub-view id="asv">
25    </tr-ui-a-alert-sub-view>
26  </template>
27  <script>
28  'use strict';
29
30  Polymer({
31    ready: function() {
32      this.currentSelection_ = undefined;
33    },
34
35    get selection() {
36      return this.currentSelection_;
37    },
38
39    set selection(selection) {
40      if (selection.length != 1)
41        throw new Error('Only supports single frame!');
42      this.currentSelection_ = selection;
43      this.$.asv.selection = selection[0].associatedAlerts;
44    },
45
46    get relatedEventsToHighlight() {
47      if (!this.currentSelection_)
48        return undefined;
49      return this.currentSelection_[0].associatedEvents;
50    }
51  });
52  </script>
53</polymer-element>
54