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/tracks/letter_dot_track.html">
9<script>
10'use strict';
11
12tr.exportTo('tr.ui.tracks', function() {
13  /**
14   * A track that displays an array of alert objects.
15   * @constructor
16   * @extends {LetterDotTrack}
17   */
18  var AlertTrack = tr.ui.b.define(
19      'alert-track', tr.ui.tracks.LetterDotTrack);
20
21  AlertTrack.prototype = {
22    __proto__: tr.ui.tracks.LetterDotTrack.prototype,
23
24    decorate: function(viewport) {
25      tr.ui.tracks.LetterDotTrack.prototype.decorate.call(this, viewport);
26      this.heading = 'Alerts';
27      this.alerts_ = undefined;
28    },
29
30    get alerts() {
31      return this.alerts_;
32    },
33
34    set alerts(alerts) {
35      this.alerts_ = alerts;
36      if (alerts === undefined) {
37        this.items = undefined;
38        return;
39      }
40      this.items = this.alerts_.map(function(alert) {
41        return new tr.ui.tracks.LetterDot(
42            alert, String.fromCharCode(9888), alert.colorId, alert.start);
43      });
44    }
45  };
46
47  return {
48    AlertTrack: AlertTrack
49  };
50});
51</script>
52