OLD | NEW |
1 /** | 1 /** |
2 * Copyright 2014 The Chromium Authors. All rights reserved. | 2 * Copyright 2014 The Chromium Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /** | 7 /** |
8 * See http://dev.w3.org/2011/webrtc/editor/getusermedia.html for more | 8 * See http://dev.w3.org/2011/webrtc/editor/getusermedia.html for more |
9 * information on getUserMedia. See | 9 * information on getUserMedia. See |
10 * http://dev.w3.org/2011/webrtc/editor/webrtc.html for more information on | 10 * http://dev.w3.org/2011/webrtc/editor/webrtc.html for more information on |
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 print_handler_(message, 'debug', 'red'); | 1149 print_handler_(message, 'debug', 'red'); |
1150 } | 1150 } |
1151 | 1151 |
1152 /** | 1152 /** |
1153 * @private | 1153 * @private |
1154 * @param {string} message Text to print. | 1154 * @param {string} message Text to print. |
1155 * @param {string} textField Element ID of where to print. | 1155 * @param {string} textField Element ID of where to print. |
1156 * @param {string} color Color of the text. | 1156 * @param {string} color Color of the text. |
1157 */ | 1157 */ |
1158 function print_handler_(message, textField, color) { | 1158 function print_handler_(message, textField, color) { |
1159 if (color == 'red' ) | |
1160 throw new Error(message); | |
1161 | |
1162 if (color == 'green' ) | 1159 if (color == 'green' ) |
1163 message += ' success'; | 1160 message += ' success'; |
1164 | 1161 |
1165 $(textField).innerHTML += '<span style="color:' + color + ';">' + message + | 1162 $(textField).innerHTML += '<span style="color:' + color + ';">' + message + |
1166 '</span><br>' | 1163 '</span><br>' |
| 1164 console.log(message); |
1167 | 1165 |
1168 console.log(message); | 1166 if (color == 'red' ) |
| 1167 throw new Error(message); |
1169 } | 1168 } |
1170 | 1169 |
1171 /** | 1170 /** |
1172 * @private | 1171 * @private |
1173 * @param {string} stringRepresentation JavaScript as a string. | 1172 * @param {string} stringRepresentation JavaScript as a string. |
1174 * @return {Object} The PeerConnection constraints as a JavaScript dictionary. | 1173 * @return {Object} The PeerConnection constraints as a JavaScript dictionary. |
1175 */ | 1174 */ |
1176 function getEvaluatedJavaScript_(stringRepresentation) { | 1175 function getEvaluatedJavaScript_(stringRepresentation) { |
1177 try { | 1176 try { |
1178 var evaluatedJavaScript; | 1177 var evaluatedJavaScript; |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1411 | 1410 |
1412 /** @private */ | 1411 /** @private */ |
1413 function readResponseHeader_(request, key) { | 1412 function readResponseHeader_(request, key) { |
1414 var value = request.getResponseHeader(key); | 1413 var value = request.getResponseHeader(key); |
1415 if (value == null || value.length == 0) { | 1414 if (value == null || value.length == 0) { |
1416 error_('Received empty value ' + value + | 1415 error_('Received empty value ' + value + |
1417 ' for response header key ' + key + '.'); | 1416 ' for response header key ' + key + '.'); |
1418 } | 1417 } |
1419 return parseInt(value); | 1418 return parseInt(value); |
1420 } | 1419 } |
OLD | NEW |