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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 remoting.httpXmppProxy); | 106 remoting.httpXmppProxy); |
107 return; | 107 return; |
108 } | 108 } |
109 | 109 |
110 // Setup the callback that the plugin will call when the connection status | 110 // Setup the callback that the plugin will call when the connection status |
111 // has changes and the UI needs to be updated. It needs to be an object with | 111 // has changes and the UI needs to be updated. It needs to be an object with |
112 // a 'callback' property that contains the callback function. | 112 // a 'callback' property that contains the callback function. |
113 plugin.connectionInfoUpdate = connectionInfoUpdateCallback; | 113 plugin.connectionInfoUpdate = connectionInfoUpdateCallback; |
114 plugin.debugInfo = debugInfoCallback; | 114 plugin.debugInfo = debugInfoCallback; |
115 plugin.desktopSizeUpdate = desktopSizeChanged; | 115 plugin.desktopSizeUpdate = desktopSizeChanged; |
116 plugin.loginChallenge = loginChallengeCallback; | |
Wez
2011/05/23 21:14:54
The code path that makes the loginChallenge callba
Jamie
2011/05/23 22:24:58
Done.
| |
117 | 116 |
118 addToDebugLog('Connect as user ' + remoting.username); | 117 addToDebugLog('Connect as user ' + remoting.username); |
119 | 118 |
120 // TODO(garykac): Clean exit if |connect| isn't a function. | 119 // TODO(garykac): Clean exit if |connect| isn't a function. |
121 if (typeof plugin.connect === 'function') { | 120 if (typeof plugin.connect === 'function') { |
122 if (remoting.connectMethod == 'sandboxed') { | 121 if (remoting.connectMethod == 'sandboxed') { |
123 registerConnection(); | 122 registerConnection(); |
124 } else { | 123 } else { |
125 plugin.connect(remoting.username, remoting.hostjid, | 124 plugin.connect(remoting.username, remoting.hostjid, |
126 remoting.xmppAuthToken, remoting.accessCode); | 125 remoting.xmppAuthToken, remoting.accessCode); |
(...skipping 19 matching lines...) Expand all Loading... | |
146 } | 145 } |
147 | 146 |
148 function toggleScaleToFit() { | 147 function toggleScaleToFit() { |
149 remoting.scaleToFit = !remoting.scaleToFit; | 148 remoting.scaleToFit = !remoting.scaleToFit; |
150 document.getElementById('scale_to_fit_toggle').value = | 149 document.getElementById('scale_to_fit_toggle').value = |
151 remoting.scaleToFit ? 'No scaling' : 'Scale to fit'; | 150 remoting.scaleToFit ? 'No scaling' : 'Scale to fit'; |
152 remoting.plugin.setScaleToFit(remoting.scaleToFit); | 151 remoting.plugin.setScaleToFit(remoting.scaleToFit); |
153 } | 152 } |
154 | 153 |
155 /** | 154 /** |
156 * This is the callback method that the plugin calls to request username and | |
157 * password for logging into the remote host. For Me2Mom we are pre-authorized | |
158 * so this should never be called. | |
159 */ | |
160 function loginChallengeCallback() { | |
161 console.log("loginChallengeCallback called unexpectedly!"); | |
Wez
2011/05/23 21:14:54
Just take out the console.log() for now?
Jamie
2011/05/23 22:24:58
Done.
| |
162 } | |
163 | |
164 /** | |
165 * This is a callback that gets called when the desktop size contained in the | 155 * This is a callback that gets called when the desktop size contained in the |
166 * the plugin has changed. | 156 * the plugin has changed. |
167 */ | 157 */ |
168 function desktopSizeChanged() { | 158 function desktopSizeChanged() { |
169 var width = remoting.plugin.desktopWidth; | 159 var width = remoting.plugin.desktopWidth; |
170 var height = remoting.plugin.desktopHeight; | 160 var height = remoting.plugin.desktopHeight; |
171 | 161 |
172 addToDebugLog('desktop size changed: ' + width + 'x' + height); | 162 addToDebugLog('desktop size changed: ' + width + 'x' + height); |
173 remoting.plugin.style.width = width + 'px'; | 163 remoting.plugin.style.width = width + 'px'; |
174 remoting.plugin.style.height = height + 'px'; | 164 remoting.plugin.style.height = height + 'px'; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
310 setClientStateMessage( | 300 setClientStateMessage( |
311 'Video stats: bandwidth: ' + videoBandwidth.toFixed(2) + 'Kbps' + | 301 'Video stats: bandwidth: ' + videoBandwidth.toFixed(2) + 'Kbps' + |
312 ', Latency: capture: ' + videoCaptureLatency.toFixed(2) + 'ms' + | 302 ', Latency: capture: ' + videoCaptureLatency.toFixed(2) + 'ms' + |
313 ', encode: ' + videoEncodeLatency.toFixed(2) + 'ms' + | 303 ', encode: ' + videoEncodeLatency.toFixed(2) + 'ms' + |
314 ', decode: ' + videoDecodeLatency.toFixed(2) + 'ms' + | 304 ', decode: ' + videoDecodeLatency.toFixed(2) + 'ms' + |
315 ', render: ' + videoRenderLatency.toFixed(2) + 'ms'); | 305 ', render: ' + videoRenderLatency.toFixed(2) + 'ms'); |
316 | 306 |
317 // Update the stats once per second. | 307 // Update the stats once per second. |
318 window.setTimeout('updateStatusBarStats()', 1000); | 308 window.setTimeout('updateStatusBarStats()', 1000); |
319 } | 309 } |
OLD | NEW |