OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 ClientRenderer = (function() { | 5 var ClientRenderer = (function() { |
6 var ClientRenderer = function() { | 6 var ClientRenderer = function() { |
7 this.playerListElement = document.getElementById('player-list'); | 7 this.playerListElement = document.getElementById('player-list'); |
8 this.propertiesTable = | 8 this.propertiesTable = |
9 document.getElementById('property-table').querySelector('tbody'); | 9 document.getElementById('property-table').querySelector('tbody'); |
10 this.logTable = document.getElementById('log').querySelector('tbody'); | 10 this.logTable = document.getElementById('log').querySelector('tbody'); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 if (player === this.selectedPlayer) { | 115 if (player === this.selectedPlayer) { |
116 this.drawProperties_(player.properties); | 116 this.drawProperties_(player.properties); |
117 this.drawLog_(); | 117 this.drawLog_(); |
118 this.drawGraphs_(); | 118 this.drawGraphs_(); |
119 } | 119 } |
120 if (key === 'name' || key === 'url') { | 120 if (key === 'name' || key === 'url') { |
121 this.redrawPlayerList_(players); | 121 this.redrawPlayerList_(players); |
122 } | 122 } |
123 }, | 123 }, |
124 | 124 |
| 125 redrawVideoCaptureCapabilities: function( videoCaptureCapabilities, keys ) { |
| 126 |
| 127 var copyButtonElement = |
| 128 document.getElementById('video-capture-capabilities-copy-button'); |
| 129 copyButtonElement.onclick = function() { |
| 130 window.prompt("Copy to clipboard: Ctrl+C, Enter", |
| 131 JSON.stringify(videoCaptureCapabilities)) |
| 132 } |
| 133 |
| 134 var videoTableBodyElement = |
| 135 document.getElementById('video-capture-capabilities-tbody'); |
| 136 removeChildren(videoTableBodyElement); |
| 137 |
| 138 for (var component in videoCaptureCapabilities) { |
| 139 var tableRow = document.createElement("tr"); |
| 140 var device = videoCaptureCapabilities[ component ]; |
| 141 |
| 142 for (var i in keys) { |
| 143 var value = device[keys[i]]; |
| 144 var tableCell = document.createElement("td"); |
| 145 var cellElement; |
| 146 if ( (typeof value) == (typeof []) ) { |
| 147 cellElement = document.createElement("ul"); |
| 148 for (var i in value) { |
| 149 var format = value[i]; |
| 150 var li = document.createElement("li"); |
| 151 li.appendChild(document.createTextNode(format)) |
| 152 cellElement.appendChild(li) |
| 153 } |
| 154 } else { |
| 155 cellElement = document.createTextNode( |
| 156 ((typeof value) == 'undefined') ? "n/a" : value); |
| 157 } |
| 158 tableCell.appendChild(cellElement) |
| 159 tableRow.appendChild(tableCell); |
| 160 } |
| 161 videoTableBodyElement.appendChild(tableRow); |
| 162 } |
| 163 }, |
| 164 |
125 redrawAudioComponentList_: function(componentType, components) { | 165 redrawAudioComponentList_: function(componentType, components) { |
126 function redrawList(renderer, baseName, element) { | 166 function redrawList(renderer, baseName, element) { |
127 var fragment = document.createDocumentFragment(); | 167 var fragment = document.createDocumentFragment(); |
128 for (id in components) { | 168 for (id in components) { |
129 var li = document.createElement('li'); | 169 var li = document.createElement('li'); |
130 var friendlyName = baseName + ' ' + id; | 170 var friendlyName = baseName + ' ' + id; |
131 li.appendChild(createButton( | 171 li.appendChild(createButton( |
132 friendlyName, renderer.selectAudioComponent_.bind( | 172 friendlyName, renderer.selectAudioComponent_.bind( |
133 renderer, componentType, id, components[id], friendlyName))); | 173 renderer, componentType, id, components[id], friendlyName))); |
134 fragment.appendChild(li); | 174 fragment.appendChild(li); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 if (this.selectedPlayer) { | 397 if (this.selectedPlayer) { |
358 removeChildren(this.logTable); | 398 removeChildren(this.logTable); |
359 this.selectedPlayerLogIndex = 0; | 399 this.selectedPlayerLogIndex = 0; |
360 this.drawLog_(); | 400 this.drawLog_(); |
361 } | 401 } |
362 }, | 402 }, |
363 }; | 403 }; |
364 | 404 |
365 return ClientRenderer; | 405 return ClientRenderer; |
366 })(); | 406 })(); |
OLD | NEW |