| 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 var remoting = chrome.extension.getBackgroundPage().remoting; | 8 var remoting = chrome.extension.getBackgroundPage().remoting; |
| 9 | 9 |
| 10 // Message id so that we can identify (and ignore) message fade operations for | 10 // Message id so that we can identify (and ignore) message fade operations for |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 xhr.open('POST', remoting.httpXmppProxy + '/newConnection', true); | 47 xhr.open('POST', remoting.httpXmppProxy + '/newConnection', true); |
| 48 xhr.withCredentials = true; | 48 xhr.withCredentials = true; |
| 49 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); | 49 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); |
| 50 xhr.onreadystatechange = function() { | 50 xhr.onreadystatechange = function() { |
| 51 if (xhr.readyState == 4) { | 51 if (xhr.readyState == 4) { |
| 52 if (xhr.status == 200) { | 52 if (xhr.status == 200) { |
| 53 addToDebugLog('Receiving Iq: --' + xhr.responseText + '--'); | 53 addToDebugLog('Receiving Iq: --' + xhr.responseText + '--'); |
| 54 var clientjid = xhr.responseText; | 54 var clientjid = xhr.responseText; |
| 55 | 55 |
| 56 remoting.plugin.sendIq = sendIq; | 56 remoting.plugin.sendIq = sendIq; |
| 57 remoting.plugin.connectSandboxed(clientjid, remoting.hostjid, | 57 remoting.plugin.connectSandboxedNonce(clientjid, remoting.hostjid, |
| 58 remoting.accessCode); | 58 remoting.accessCode); |
| 59 // TODO(ajwong): This should just be feedIq(); | 59 // TODO(ajwong): This should just be feedIq(); |
| 60 window.setTimeout(feedIq, 1000); | 60 window.setTimeout(feedIq, 1000); |
| 61 } else { | 61 } else { |
| 62 addToDebugLog('FailedToConnect: --' + xhr.responseText + | 62 addToDebugLog('FailedToConnect: --' + xhr.responseText + |
| 63 '-- (status=' + xhr.status + ')'); | 63 '-- (status=' + xhr.status + ')'); |
| 64 setClientStateMessage('Failed'); | 64 setClientStateMessage('Failed'); |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 xhr.send('host_jid=' + encodeURIComponent(remoting.hostjid) + | 68 xhr.send('host_jid=' + encodeURIComponent(remoting.hostjid) + |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 plugin.desktopSizeUpdate = desktopSizeChanged; | 115 plugin.desktopSizeUpdate = desktopSizeChanged; |
| 116 plugin.loginChallenge = loginChallengeCallback; | 116 plugin.loginChallenge = loginChallengeCallback; |
| 117 | 117 |
| 118 addToDebugLog('Connect as user ' + remoting.username); | 118 addToDebugLog('Connect as user ' + remoting.username); |
| 119 | 119 |
| 120 // TODO(garykac): Clean exit if |connect| isn't a function. | 120 // TODO(garykac): Clean exit if |connect| isn't a function. |
| 121 if (typeof plugin.connect === 'function') { | 121 if (typeof plugin.connect === 'function') { |
| 122 if (remoting.connectMethod == 'sandboxed') { | 122 if (remoting.connectMethod == 'sandboxed') { |
| 123 registerConnection(); | 123 registerConnection(); |
| 124 } else { | 124 } else { |
| 125 plugin.connect(remoting.username, remoting.hostjid, | 125 plugin.connectNonce(remoting.username, remoting.hostjid, |
| 126 remoting.xmppAuthToken, remoting.accessCode); | 126 remoting.xmppAuthToken, remoting.accessCode); |
| 127 } | 127 } |
| 128 } else { | 128 } else { |
| 129 addToDebugLog('ERROR: remoting plugin not loaded'); | 129 addToDebugLog('ERROR: remoting plugin not loaded'); |
| 130 setClientStateMessage('Plugin not loaded'); | 130 setClientStateMessage('Plugin not loaded'); |
| 131 } | 131 } |
| 132 | 132 |
| 133 } | 133 } |
| 134 | 134 |
| 135 function toggleDebugLog() { | 135 function toggleDebugLog() { |
| 136 debugLog = document.getElementById('debug_log'); | 136 debugLog = document.getElementById('debug_log'); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 setClientStateMessage( | 322 setClientStateMessage( |
| 323 'Video stats: bandwidth: ' + videoBandwidth.toFixed(2) + 'Kbps' + | 323 'Video stats: bandwidth: ' + videoBandwidth.toFixed(2) + 'Kbps' + |
| 324 ', Latency: capture: ' + videoCaptureLatency.toFixed(2) + 'ms' + | 324 ', Latency: capture: ' + videoCaptureLatency.toFixed(2) + 'ms' + |
| 325 ', encode: ' + videoEncodeLatency.toFixed(2) + 'ms' + | 325 ', encode: ' + videoEncodeLatency.toFixed(2) + 'ms' + |
| 326 ', decode: ' + videoDecodeLatency.toFixed(2) + 'ms' + | 326 ', decode: ' + videoDecodeLatency.toFixed(2) + 'ms' + |
| 327 ', render: ' + videoRenderLatency.toFixed(2) + 'ms'); | 327 ', render: ' + videoRenderLatency.toFixed(2) + 'ms'); |
| 328 | 328 |
| 329 // Update the stats once per second. | 329 // Update the stats once per second. |
| 330 window.setTimeout('updateStatusBarStats()', 1000); | 330 window.setTimeout('updateStatusBarStats()', 1000); |
| 331 } | 331 } |
| OLD | NEW |