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/model/event_set.html">
9<link rel="import" href="/tracing/ui/analysis/multi_event_sub_view.html">
10<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
11
12<polymer-element name="tr-ui-a-multi-user-expectation-sub-view"
13    extends="tr-ui-a-sub-view">
14  <script>
15  'use strict';
16
17  Polymer({
18    created: function() {
19      this.currentSelection_ = undefined;
20    },
21
22    set selection(selection) {
23      this.currentSelection_ = selection;
24      this.textContent = '';
25      var realView = document.createElement('tr-ui-a-multi-event-sub-view');
26
27      this.appendChild(realView);
28      realView.setSelectionWithoutErrorChecks(selection);
29
30      this.currentSelection_ = selection;
31    },
32
33    get selection() {
34      return this.currentSelection_;
35    },
36
37    get relatedEventsToHighlight() {
38      if (!this.currentSelection_)
39        return undefined;
40      var selection = new tr.model.EventSet();
41      this.currentSelection_.forEach(function(ir) {
42        ir.associatedEvents.forEach(function(event) {
43          selection.push(event);
44        });
45      });
46      return selection;
47    }
48  });
49  </script>
50</polymer-element>
51