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

Unified Diff: content/browser/resources/media/new/player_list_painter.js

Issue 18889006: Removed old media-internals page and rewrote it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved all 'new' media internals files into its own folder for a smooth transition. Created 7 years, 5 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: content/browser/resources/media/new/player_list_painter.js
diff --git a/content/browser/resources/media/new/player_list_painter.js b/content/browser/resources/media/new/player_list_painter.js
new file mode 100644
index 0000000000000000000000000000000000000000..1c564d573e0cbe31a24d0b7066abf5e047a92c84
--- /dev/null
+++ b/content/browser/resources/media/new/player_list_painter.js
@@ -0,0 +1,48 @@
+// Copyright (c) 2012 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.
+
+var playerListPainter = (function () {
+ "use strict";
+ var playerListPainter = {};
+
+ playerListPainter.paintNew = function (playerInfo, div, opt_properties) {
+ var ul = document.createElement('ul');
+ var playerManager = opt_properties.playerManager;
+
+ goog.object.forEach(playerManager.players, function (player, id) {
+ // If we have the opportunity to name it
+ // something human readable, do so.
+
+ var name;
+ // If we have a url, use the file name (but not path) as the
+ // name that is displayed
+ if (player.properties.url) {
+ var split = player.properties.url.split("/");
+ name = split[split.length - 1];
+ }
+
+ name = name || player.properties.name || "player " + id;
+ var li = document.createElement('li');
+ var btn = document.createElement('button');
+
+ btn.onclick = function () {
+ playerManager.selectPlayer(id);
+ };
+
+ btn.appendChild(document.createTextNode(name));
+ li.appendChild(btn);
+ ul.appendChild(li);
+ });
+
+ removeChildren(div);
+ div.appendChild(ul);
+ };
+
+ playerListPainter.paintExist = playerListPainter.paintNew;
+
+ playerListPainter.invalidate = function () {
+ };
+
+ return playerListPainter;
+}());
« no previous file with comments | « content/browser/resources/media/new/player_info.js ('k') | content/browser/resources/media/new/player_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698