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 // Message id so that we can identify (and ignore) message fade operations for | 9 // Message id so that we can identify (and ignore) message fade operations for |
10 // old messages. This starts at 1 and is incremented for each new message. | 10 // old messages. This starts at 1 and is incremented for each new message. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 xhr.open("POST", chromoting.httpXmppProxy + '/newConnection', true); | 45 xhr.open("POST", chromoting.httpXmppProxy + '/newConnection', true); |
46 xhr.withCredentials = true; | 46 xhr.withCredentials = true; |
47 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); | 47 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); |
48 xhr.onreadystatechange = function() { | 48 xhr.onreadystatechange = function() { |
49 if (xhr.readyState == 4) { | 49 if (xhr.readyState == 4) { |
50 if (xhr.status == 200) { | 50 if (xhr.status == 200) { |
51 addToDebugLog('Receiving Iq: --' + xhr.responseText + '--'); | 51 addToDebugLog('Receiving Iq: --' + xhr.responseText + '--'); |
52 var clientjid = xhr.responseText; | 52 var clientjid = xhr.responseText; |
53 | 53 |
54 chromoting.plugin.sendIq = sendIq; | 54 chromoting.plugin.sendIq = sendIq; |
55 // TODO:(jamiewalch): Pass in the correct nonce. | 55 chromoting.plugin.connectSandboxed(clientjid, chromoting.hostjid); |
56 chromoting.plugin.connectSandboxed(clientjid, chromoting.hostjid, ''); | |
57 // TODO(ajwong): This should just be feedIq(); | 56 // TODO(ajwong): This should just be feedIq(); |
58 window.setTimeout(feedIq, 1000); | 57 window.setTimeout(feedIq, 1000); |
59 } else { | 58 } else { |
60 addToDebugLog('FailedToConnect: --' + xhr.responseText + | 59 addToDebugLog('FailedToConnect: --' + xhr.responseText + |
61 '-- (status=' + xhr.status + ')'); | 60 '-- (status=' + xhr.status + ')'); |
62 setClientStateMessage("Failed") | 61 setClientStateMessage("Failed") |
63 } | 62 } |
64 } | 63 } |
65 } | 64 } |
66 xhr.send('host_jid=' + encodeURIComponent(chromoting.hostjid) + | 65 xhr.send('host_jid=' + encodeURIComponent(chromoting.hostjid) + |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 plugin.loginChallenge = loginChallengeCallback; | 122 plugin.loginChallenge = loginChallengeCallback; |
124 | 123 |
125 addToDebugLog('Connect to ' + chromoting.hostname + ' as user ' + | 124 addToDebugLog('Connect to ' + chromoting.hostname + ' as user ' + |
126 chromoting.username); | 125 chromoting.username); |
127 | 126 |
128 // TODO(garykac): Clean exit if |connect| isn't a function. | 127 // TODO(garykac): Clean exit if |connect| isn't a function. |
129 if (typeof plugin.connect === 'function') { | 128 if (typeof plugin.connect === 'function') { |
130 if (chromoting.connectMethod == "sandboxed") { | 129 if (chromoting.connectMethod == "sandboxed") { |
131 registerConnection(); | 130 registerConnection(); |
132 } else { | 131 } else { |
133 // TODO:(jamiewalch): Pass in the correct nonce. | |
134 plugin.connect(chromoting.username, chromoting.hostjid, | 132 plugin.connect(chromoting.username, chromoting.hostjid, |
135 chromoting.xmppAuthToken, ''); | 133 chromoting.xmppAuthToken); |
136 } | 134 } |
137 } else { | 135 } else { |
138 addToDebugLog('ERROR: chromoting plugin not loaded'); | 136 addToDebugLog('ERROR: chromoting plugin not loaded'); |
139 setClientStateMessage('Plugin not loaded'); | 137 setClientStateMessage('Plugin not loaded'); |
140 } | 138 } |
141 | 139 |
142 document.getElementById('title').innerText = chromoting.hostname; | 140 document.getElementById('title').innerText = chromoting.hostname; |
143 } | 141 } |
144 | 142 |
145 function toggleDebugLog() { | 143 function toggleDebugLog() { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 setClientStateMessage( | 337 setClientStateMessage( |
340 "Video stats: bandwidth: " + videoBandwidth.toFixed(2) + "Kbps" + | 338 "Video stats: bandwidth: " + videoBandwidth.toFixed(2) + "Kbps" + |
341 ", Latency: capture: " + videoCaptureLatency.toFixed(2) + "ms" + | 339 ", Latency: capture: " + videoCaptureLatency.toFixed(2) + "ms" + |
342 ", encode: " + videoEncodeLatency.toFixed(2) + "ms" + | 340 ", encode: " + videoEncodeLatency.toFixed(2) + "ms" + |
343 ", decode: " + videoDecodeLatency.toFixed(2) + "ms" + | 341 ", decode: " + videoDecodeLatency.toFixed(2) + "ms" + |
344 ", render: " + videoRenderLatency.toFixed(2) + "ms"); | 342 ", render: " + videoRenderLatency.toFixed(2) + "ms"); |
345 | 343 |
346 // Update the stats once per second. | 344 // Update the stats once per second. |
347 window.setTimeout("updateStatusBarStats()", 1000); | 345 window.setTimeout("updateStatusBarStats()", 1000); |
348 } | 346 } |
OLD | NEW |