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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 xhr.open("POST", chromoting.httpXmppProxy + '/newConnection', true); | 47 xhr.open("POST", chromoting.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 chromoting.plugin.sendIq = sendIq; | 56 chromoting.plugin.sendIq = sendIq; |
57 chromoting.plugin.connect(chromoting.hostjid, clientjid); | 57 // TODO:(jamiewalch): Pass in the correct nonce. |
| 58 chromoting.plugin.connectSandboxed(clientjid, chromoting.hostjid); |
58 // TODO(ajwong): This should just be feedIq(); | 59 // TODO(ajwong): This should just be feedIq(); |
59 window.setTimeout(feedIq, 1000); | 60 window.setTimeout(feedIq, 1000); |
60 } else { | 61 } else { |
61 addToDebugLog('FailedToConnect: --' + xhr.responseText + | 62 addToDebugLog('FailedToConnect: --' + xhr.responseText + |
62 '-- (status=' + xhr.status + ')'); | 63 '-- (status=' + xhr.status + ')'); |
63 setClientStateMessage("Failed") | 64 setClientStateMessage("Failed") |
64 } | 65 } |
65 } | 66 } |
66 } | 67 } |
67 xhr.send('host_jid=' + encodeURIComponent(chromoting.hostjid) + | 68 xhr.send('host_jid=' + encodeURIComponent(chromoting.hostjid) + |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 plugin.loginChallenge = loginChallengeCallback; | 125 plugin.loginChallenge = loginChallengeCallback; |
125 | 126 |
126 addToDebugLog('Connect to ' + chromoting.hostname + ' as user ' + | 127 addToDebugLog('Connect to ' + chromoting.hostname + ' as user ' + |
127 chromoting.username); | 128 chromoting.username); |
128 | 129 |
129 // TODO(garykac): Clean exit if |connect| isn't a function. | 130 // TODO(garykac): Clean exit if |connect| isn't a function. |
130 if (typeof plugin.connect === 'function') { | 131 if (typeof plugin.connect === 'function') { |
131 if (chromoting.connectMethod == "sandboxed") { | 132 if (chromoting.connectMethod == "sandboxed") { |
132 registerConnection(); | 133 registerConnection(); |
133 } else { | 134 } else { |
134 plugin.connectUnsandboxed(chromoting.hostjid, chromoting.username, | 135 // TODO:(jamiewalch): Pass in the correct nonce. |
135 chromoting.talkToken); | 136 plugin.connect(chromoting.username, chromoting.hostjid, |
| 137 chromoting.talkToken, ''); |
136 } | 138 } |
137 } else { | 139 } else { |
138 addToDebugLog('ERROR: chromoting plugin not loaded'); | 140 addToDebugLog('ERROR: chromoting plugin not loaded'); |
139 setClientStateMessage('Plugin not loaded'); | 141 setClientStateMessage('Plugin not loaded'); |
140 } | 142 } |
141 | 143 |
142 document.getElementById('title').innerText = chromoting.hostname; | 144 document.getElementById('title').innerText = chromoting.hostname; |
143 } | 145 } |
144 | 146 |
145 function toggleDebugLog() { | 147 function toggleDebugLog() { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 setClientStateMessage( | 341 setClientStateMessage( |
340 "Video stats: bandwidth: " + videoBandwidth.toFixed(2) + "Kbps" + | 342 "Video stats: bandwidth: " + videoBandwidth.toFixed(2) + "Kbps" + |
341 ", Latency: capture: " + videoCaptureLatency.toFixed(2) + "ms" + | 343 ", Latency: capture: " + videoCaptureLatency.toFixed(2) + "ms" + |
342 ", encode: " + videoEncodeLatency.toFixed(2) + "ms" + | 344 ", encode: " + videoEncodeLatency.toFixed(2) + "ms" + |
343 ", decode: " + videoDecodeLatency.toFixed(2) + "ms" + | 345 ", decode: " + videoDecodeLatency.toFixed(2) + "ms" + |
344 ", render: " + videoRenderLatency.toFixed(2) + "ms"); | 346 ", render: " + videoRenderLatency.toFixed(2) + "ms"); |
345 | 347 |
346 // Update the stats once per second. | 348 // Update the stats once per second. |
347 window.setTimeout("updateStatusBarStats()", 1000); | 349 window.setTimeout("updateStatusBarStats()", 1000); |
348 } | 350 } |
OLD | NEW |