Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: chrome/browser/resources/media_internals/event_list.js

Issue 7972028: Display active media players on chrome://media-internals. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: fixes Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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.
4
5 cr.define('media', function() {
6 'use strict';
7
8 /**
9 * This class holds a list of MediaLogEvents.
10 * It inherits from <li> and contains a tabular list of said events,
11 * the time at which they occurred, and their parameters.
12 */
13 var EventList = cr.ui.define('li');
14
15 EventList.prototype = {
16 __proto__: HTMLLIElement.prototype,
17 startTime_: null,
18
19 /**
20 * Decorate this list item as an EventList.
21 */
22 decorate: function() {
23 this.table_ = document.createElement('table');
24 var details = document.createElement('details');
25 var summary = media.makeElement('summary', 'Log:');
26 details.appendChild(summary);
27 details.appendChild(this.table_);
28 this.appendChild(details);
29
30 var hRow = document.createElement('tr');
31 hRow.appendChild(media.makeElement('th', 'Time:'));
32 hRow.appendChild(media.makeElement('th', 'Event:'));
33 hRow.appendChild(media.makeElement('th', 'Parameters:'));
34 var header = document.createElement('thead');
35 header.appendChild(hRow);
36 this.table_.appendChild(header);
37 },
38
39 /**
40 * Add an event to the list. It is stored as a new row in this.table_.
41 * @param {Object} event The MediaLogEvent that has occurred.
42 */
43 addEvent: function(event) {
44 this.startTime_ = this.startTime_ || event.time;
45 event.time -= this.startTime_;
46
47 var row = document.createElement('tr');
48 row.appendChild(media.makeElement('td', media.round(event.time)));
49 row.appendChild(media.makeElement('td', event.type));
50 var params = [];
51 for (var p in event.params) {
52 params.push(p + ': ' + event.params[p]);
53 }
54
55 row.appendChild(media.makeElement('td', params.join(', ')));
56 this.table_.appendChild(row);
57 }
58 };
59
60 return {
61 EventList: EventList
62 };
63 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698