1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 tvcm.requireStylesheet('tracing.tracks.heading_track');
9 tvcm.require('tracing.constants');
10 tvcm.require('tracing.tracks.track');
11 tvcm.require('tvcm.ui');
13 tvcm.exportTo('tracing.tracks', function() {
15 * A track with a header. Provides the basic heading and tooltip
16 * infrastructure. Subclasses must implement drawing code.
18 * @extends {HTMLDivElement}
20 var HeadingTrack = tvcm.ui.define('heading-track', tracing.tracks.Track);
22 HeadingTrack.prototype = {
23 __proto__: tracing.tracks.Track.prototype,
25 decorate: function(viewport) {
26 tracing.tracks.Track.prototype.decorate.call(this, viewport);
27 this.classList.add('heading-track');
29 this.headingDiv_ = document.createElement('heading');
30 this.headingDiv_.style.width = tracing.constants.HEADING_WIDTH + 'px';
32 this.selectionGenerator_ = undefined;
33 this.updateContents_();
42 this.updateContents_();
46 this.headingDiv_.title = text;
49 set selectionGenerator(generator) {
50 this.selectionGenerator_ = generator;
51 this.updateContents_();
54 updateContents_: function() {
56 * If this is a heading track of a sampling thread, we add a link to
57 * the heading text ("Sampling Thread"). We associate a selection
58 * generator with the link so that sampling profiling results are
59 * displayed in the bottom frame when you click the link.
61 this.headingDiv_.innerHTML = '';
62 if (this.selectionGenerator_) {
63 this.headingLink_ = document.createElement('a');
64 tracing.analysis.AnalysisLink.decorate(this.headingLink_);
65 this.headingLink_.selectionGenerator = this.selectionGenerator_;
66 this.headingDiv_.appendChild(this.headingLink_);
67 this.headingLink_.appendChild(document.createTextNode(this.heading_));
69 this.headingDiv_.appendChild(document.createTextNode(this.heading_));
71 this.appendChild(this.headingDiv_);
74 draw: function(type, viewLWorld, viewRWorld) {
75 throw new Error('draw implementation missing');
80 HeadingTrack: HeadingTrack