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

Side by Side Diff: chrome/browser/resources/webrtc_internals/webrtc_internals.js

Issue 11876007: Connecting webrtc-internals WebUI frontend with the backend (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@main
Patch Set: Created 7 years, 11 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
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var peerConnectionsListElem = null;
6
5 function initialize() { 7 function initialize() {
8 peerConnectionsListElem = $('peer-connections-list');
9 }
10
11 function getPeerConnectionId(data) {
12 return data.pid + ':' + data.lid;
13 }
14
15 // Makes sure a LI element representing a PeerConnection is created
16 // and appended to peerConnectionListElem.
17 function ensurePeerConnectionElement(id) {
18 var element = $(id);
19 if (!element) {
20 element = document.createElement('li');
21 peerConnectionsListElem.appendChild(element);
22 element.id = id;
23 }
24 return element;
25 }
26
27 //
28 // Browser message handlers
29 //
30
31 function removePeerConnection(data) {
32 var element = $(getPeerConnectionId(data));
33 if (element)
34 peerConnectionsListElem.removeChild(element);
35 }
36
37 function addPeerConnection(data) {
38 var peerConnectionElement = ensurePeerConnectionElement(
39 getPeerConnectionId(data));
40 peerConnectionElement.innerHTML = 'PeerConnection ' +
41 peerConnectionElement.id + '<br>' +
42 data.url + ', ' +
43 data.servers + ', ' +
44 data.constraints + '<br>';
6 } 45 }
7 46
8 document.addEventListener('DOMContentLoaded', initialize); 47 document.addEventListener('DOMContentLoaded', initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698