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

Unified Diff: chrome/browser/resources/media_internals/event_list.js

Issue 7653001: Display active media players on chrome://media-internals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/media_internals/event_list.js
diff --git a/chrome/browser/resources/media_internals/event_list.js b/chrome/browser/resources/media_internals/event_list.js
new file mode 100644
index 0000000000000000000000000000000000000000..88a7406afe3917676950bd2c59f5cc673d738a9b
--- /dev/null
+++ b/chrome/browser/resources/media_internals/event_list.js
@@ -0,0 +1,53 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('media', function() {
+
+ /**
+ * This class holds a list of MediaLogEvents.
+ * It exposes an <li> element that contains a tabular list of said events,
+ * the time at which they occurred, and their parameters.
+ */
+ function EventList() {
+ this.table_ = document.createElement('table');
+ this.li = createDetailsLi();
+ this.li.details.appendChild(this.table_);
+ this.li.summary.textContent = 'Log:';
+
+ this.startTime_ = null;
+
+ var hrow = document.createElement('tr');
arv (Not doing code reviews) 2011/08/16 19:29:03 hRow
Scott Franklin 2011/08/16 23:33:52 Done.
+ hrow.appendChild(makeElement('th', 'Time:'));
+ hrow.appendChild(makeElement('th', 'Event:'));
+ hrow.appendChild(makeElement('th', 'Parameters:'));
+ var header = document.createElement('thead');
+ header.appendChild(hrow);
+ this.table_.appendChild(header);
+ };
+
+ EventList.prototype = {
+
+ /**
+ * Add an event to the list. It is stored as a new row in this.table_.
+ * @param {Object} event The MediaLogEvent that has occurred.
+ */
+ addEvent: function(event) {
+ this.startTime_ = this.startTime_ || event.time;
+ event.time -= this.startTime_;
+
+ var row = document.createElement('tr');
+ row.appendChild(makeElement('td', media.round(event.time)));
+ row.appendChild(makeElement('td', event.type));
+ params = [];
arv (Not doing code reviews) 2011/08/16 19:29:03 missing var
Scott Franklin 2011/08/16 23:33:52 Done.
+ for (var p in event.params)
+ params.push(p + ': ' + event.params[p]);
+ row.appendChild(makeElement('td', params.join(', ')));
+ this.table_.appendChild(row);
+ },
scherkus (not reviewing) 2011/08/16 19:18:29 trailing , ?
Scott Franklin 2011/08/16 23:33:52 Done.
+ };
+
+ return {
+ EventList: EventList,
scherkus (not reviewing) 2011/08/16 19:18:29 trailing , ?
Scott Franklin 2011/08/16 23:33:52 Done.
+ };
+});

Powered by Google App Engine
This is Rietveld 408576698