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/base/draw_helpers.html">
9<link rel="import" href="/tracing/ui/base/ui.html">
10<link rel="import" href="/tracing/ui/tracks/alert_track.html">
11<link rel="import" href="/tracing/ui/tracks/container_track.html">
12<link rel="import" href="/tracing/ui/tracks/drawing_container.html">
13<link rel="import" href="/tracing/ui/tracks/highlighter.html">
14<link rel="import" href="/tracing/ui/tracks/kernel_track.html">
15
16<script>
17'use strict';
18
19tr.exportTo('tr.ui.tracks', function() {
20  /**
21   * A track that displays an array of interaction records.
22   * @constructor
23   * @extends {MultiRowTrack}
24   */
25  var InteractionTrack = tr.ui.b.define(
26      'interaction-track', tr.ui.tracks.MultiRowTrack);
27
28  InteractionTrack.prototype = {
29    __proto__: tr.ui.tracks.MultiRowTrack.prototype,
30
31    decorate: function(viewport) {
32      tr.ui.tracks.MultiRowTrack.prototype.decorate.call(this, viewport);
33      this.heading = 'Interactions';
34      this.subRows_ = [];
35    },
36
37    set model(model) {
38      this.setItemsToGroup(model.userModel.expectations, {
39        guid: tr.b.GUID.allocate(),
40        model: model,
41        getSettingsKey: function() {
42          return undefined;
43        }
44      });
45    },
46
47    buildSubRows_: function(slices) {
48      if (this.subRows_.length)
49        return this.subRows_;
50      this.subRows_.push.apply(this.subRows_,
51          tr.ui.tracks.AsyncSliceGroupTrack.prototype.buildSubRows_.call(
52          {}, slices, true));
53      return this.subRows_;
54    },
55
56    addSubTrack_: function(slices) {
57      var track = new tr.ui.tracks.SliceTrack(this.viewport);
58      track.slices = slices;
59      this.appendChild(track);
60      return track;
61    }
62  };
63
64  return {
65    InteractionTrack: InteractionTrack
66  };
67});
68</script>
69