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

Side by Side Diff: content/browser/resources/media/new/manager.js

Issue 23769009: Removes the --enable-new-media-internals flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed unused files from old-media-internals Created 7 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
OLDNEW
(Empty)
1 // Copyright 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.
4
5 /**
6 * @fileoverview Keeps track of all the existing PlayerInfo and
7 * audio stream objects and is the entry-point for messages from the backend.
8 *
9 * The events captured by Manager (add, remove, update) are relayed
10 * to the clientRenderer which it can choose to use to modify the UI.
11 */
12 var Manager = (function() {
13 'use strict';
14
15 function Manager(clientRenderer) {
16 this.players_ = {};
17 this.audioStreams_ = {};
18 this.clientRenderer_ = clientRenderer;
19 }
20
21 Manager.prototype = {
22 /**
23 * Adds an audio-stream to the dictionary of audio-streams to manage.
24 * @param id The unique-id of the audio-stream.
25 */
26 addAudioStream: function(id) {
27 this.audioStreams_[id] = this.audioStreams_[id] || {};
28 this.clientRenderer_.audioStreamAdded(this.audioStreams_,
29 this.audioStreams_[id]);
30 },
31
32 /**
33 * Sets properties of an audiostream.
34 * @param id The unique-id of the audio-stream.
35 * @param properties A dictionary of properties to be added to the
36 * audio-stream.
37 */
38 updateAudioStream: function(id, properties) {
39 for (var key in properties) {
40 this.audioStreams_[id][key] = properties[key];
41 }
42 this.clientRenderer_.audioStreamAdded(
43 this.audioStreams_, this.audioStreams_[id]);
44 },
45
46 /**
47 * Removes an audio-stream from the manager.
48 * @param id The unique-id of the audio-stream.
49 */
50 removeAudioStream: function(id) {
51 this.clientRenderer_.audioStreamRemoved(
52 this.audioStreams_, this.audioStreams_[id]);
53 delete this.audioStreams_[id];
54 },
55
56
57 /**
58 * Adds a player to the list of players to manage.
59 */
60 addPlayer: function(id) {
61 if (this.players_[id]) {
62 return;
63 }
64 // Make the PlayerProperty and add it to the mapping
65 this.players_[id] = new PlayerInfo(id);
66 this.clientRenderer_.playerAdded(this.players_, this.players_[id]);
67 },
68
69 /**
70 * Attempts to remove a player from the UI.
71 * @param id The ID of the player to remove.
72 */
73 removePlayer: function(id) {
74 delete this.players_[id];
75 this.clientRenderer_.playerRemoved(this.players_, this.players_[id]);
76 },
77
78 updatePlayerInfoNoRecord: function(id, timestamp, key, value) {
79 if (!this.players_[id]) {
80 console.error('[updatePlayerInfo] Id ' + id + ' does not exist');
81 return;
82 }
83
84 this.players_[id].addPropertyNoRecord(timestamp, key, value);
85 this.clientRenderer_.playerUpdated(this.players_,
86 this.players_[id],
87 key,
88 value);
89 },
90
91 /**
92 *
93 * @param id The unique ID that identifies the player to be updated.
94 * @param timestamp The timestamp of when the change occured. This
95 * timestamp is *not* normalized.
96 * @param key The name of the property to be added/changed.
97 * @param value The value of the property.
98 */
99 updatePlayerInfo: function(id, timestamp, key, value) {
100 if (!this.players_[id]) {
101 console.error('[updatePlayerInfo] Id ' + id + ' does not exist');
102 return;
103 }
104
105 this.players_[id].addProperty(timestamp, key, value);
106 this.clientRenderer_.playerUpdated(this.players_,
107 this.players_[id],
108 key,
109 value);
110 }
111 };
112
113 return Manager;
114 }());
OLDNEW
« no previous file with comments | « content/browser/resources/media/new/main.js ('k') | content/browser/resources/media/new/media_internals.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698