OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Maximum numer of lines to record in the debug log. | 5 // Maximum numer of lines to record in the debug log. |
6 // Only the most recent <n> lines are displayed. | 6 // Only the most recent <n> lines are displayed. |
7 var MAX_DEBUG_LOG_SIZE = 1000; | 7 var MAX_DEBUG_LOG_SIZE = 1000; |
8 | 8 |
9 var remoting = chrome.extension.getBackgroundPage().remoting; | 9 var remoting = chrome.extension.getBackgroundPage().remoting; |
10 | 10 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 plugin.apiVersion >= remoting.apiMinVersion; | 111 plugin.apiVersion >= remoting.apiMinVersion; |
112 } | 112 } |
113 | 113 |
114 function init() { | 114 function init() { |
115 // Kick off the connection. | 115 // Kick off the connection. |
116 var plugin = document.getElementById('remoting'); | 116 var plugin = document.getElementById('remoting'); |
117 | 117 |
118 remoting.plugin = plugin; | 118 remoting.plugin = plugin; |
119 | 119 |
120 // Only allow https connections to the httpXmppProxy. | 120 // Only allow https connections to the httpXmppProxy. |
121 if (remoting.httpXmppProxy.search(/^ *https:\/\//) == -1) { | 121 var regExp = /^ *https:\/\//; |
| 122 if (remoting.httpXmppProxy.search(regExp) == -1) { |
122 addToDebugLog('Aborting. httpXmppProxy does not specify https protocol: ' + | 123 addToDebugLog('Aborting. httpXmppProxy does not specify https protocol: ' + |
123 remoting.httpXmppProxy); | 124 remoting.httpXmppProxy); |
124 return; | 125 return; |
125 } | 126 } |
126 | 127 |
127 // Setup the callback that the plugin will call when the connection status | 128 // Setup the callback that the plugin will call when the connection status |
128 // has changes and the UI needs to be updated. It needs to be an object with | 129 // has changes and the UI needs to be updated. It needs to be an object with |
129 // a 'callback' property that contains the callback function. | 130 // a 'callback' property that contains the callback function. |
130 plugin.connectionInfoUpdate = connectionInfoUpdateCallback; | 131 plugin.connectionInfoUpdate = connectionInfoUpdateCallback; |
131 plugin.debugInfo = debugInfoCallback; | 132 plugin.debugInfo = debugInfoCallback; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 setClientStateMessage( | 348 setClientStateMessage( |
348 'Video stats: bandwidth: ' + videoBandwidth.toFixed(2) + units + | 349 'Video stats: bandwidth: ' + videoBandwidth.toFixed(2) + units + |
349 ', Latency: capture: ' + videoCaptureLatency.toFixed(2) + 'ms' + | 350 ', Latency: capture: ' + videoCaptureLatency.toFixed(2) + 'ms' + |
350 ', encode: ' + videoEncodeLatency.toFixed(2) + 'ms' + | 351 ', encode: ' + videoEncodeLatency.toFixed(2) + 'ms' + |
351 ', decode: ' + videoDecodeLatency.toFixed(2) + 'ms' + | 352 ', decode: ' + videoDecodeLatency.toFixed(2) + 'ms' + |
352 ', render: ' + videoRenderLatency.toFixed(2) + 'ms'); | 353 ', render: ' + videoRenderLatency.toFixed(2) + 'ms'); |
353 | 354 |
354 // Update the stats once per second. | 355 // Update the stats once per second. |
355 window.setTimeout('updateStatusBarStats()', 1000); | 356 window.setTimeout('updateStatusBarStats()', 1000); |
356 } | 357 } |
OLD | NEW |