3 Copyright (c) 2013 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file.
8 <link rel="stylesheet" href="/tracing/tracks/heading_track.css">
10 <link rel="import" href="/tracing/analysis/analysis_link.html">
11 <link rel="import" href="/tracing/constants.html">
12 <link rel="import" href="/tracing/tracks/track.html">
13 <link rel="import" href="/tvcm/ui.html">
18 tvcm.exportTo('tracing.tracks', function() {
20 * A track with a header. Provides the basic heading and tooltip
21 * infrastructure. Subclasses must implement drawing code.
23 * @extends {HTMLDivElement}
25 var HeadingTrack = tvcm.ui.define('heading-track', tracing.tracks.Track);
27 HeadingTrack.prototype = {
28 __proto__: tracing.tracks.Track.prototype,
30 decorate: function(viewport) {
31 tracing.tracks.Track.prototype.decorate.call(this, viewport);
32 this.classList.add('heading-track');
34 this.headingDiv_ = document.createElement('heading');
35 this.headingDiv_.style.width = tracing.constants.HEADING_WIDTH + 'px';
37 this.selectionGenerator_ = undefined;
38 this.updateContents_();
47 this.updateContents_();
51 this.headingDiv_.title = text;
54 set selectionGenerator(generator) {
55 this.selectionGenerator_ = generator;
56 this.updateContents_();
59 updateContents_: function() {
61 * If this is a heading track of a sampling thread, we add a link to
62 * the heading text ("Sampling Thread"). We associate a selection
63 * generator with the link so that sampling profiling results are
64 * displayed in the bottom frame when you click the link.
66 this.headingDiv_.innerHTML = '';
67 if (this.selectionGenerator_) {
68 this.headingLink_ = document.createElement('a');
69 tracing.analysis.AnalysisLink.decorate(this.headingLink_);
70 this.headingLink_.selectionGenerator = this.selectionGenerator_;
71 this.headingDiv_.appendChild(this.headingLink_);
72 this.headingLink_.appendChild(document.createTextNode(this.heading_));
74 this.headingDiv_.appendChild(document.createTextNode(this.heading_));
76 this.appendChild(this.headingDiv_);
79 draw: function(type, viewLWorld, viewRWorld) {
80 throw new Error('draw implementation missing');
85 HeadingTrack: HeadingTrack