Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Side by Side Diff: remoting/webapp/me2mom/remoting_session.js

Issue 7067002: Use OAuth2 proxy for login. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 // old messages. This starts at 1 and is incremented for each new message. 11 // old messages. This starts at 1 and is incremented for each new message.
12 remoting.messageId = 1; 12 remoting.messageId = 1;
13 13
14 remoting.scaleToFit = false; 14 remoting.scaleToFit = false;
15 15
16 // Default to trying to sandboxed connections. 16 // Default to trying to sandboxed connections.
17 remoting.connectMethod = 'sandboxed'; 17 remoting.connectMethod = 'sandboxed';
18 remoting.httpXmppProxy = 'https://chromoting-httpxmpp-dev.corp.google.com'; 18 remoting.httpXmppProxy =
19 'https://chromoting-httpxmpp-oauth2-dev.corp.google.com';
19 20
20 // This executes a poll loop on the server for more Iq packets, and feeds them 21 // This executes a poll loop on the server for more Iq packets, and feeds them
21 // to the plugin. 22 // to the plugin.
22 function feedIq() { 23 function feedIq() {
23 var xhr = new XMLHttpRequest(); 24 var xhr = new XMLHttpRequest();
24 xhr.open('GET', remoting.httpXmppProxy + '/readIq?host_jid=' + 25 xhr.open('GET', remoting.httpXmppProxy + '/readIq?host_jid=' +
25 encodeURIComponent(remoting.hostjid), true); 26 encodeURIComponent(remoting.hostjid), true);
26 xhr.withCredentials = true; 27 xhr.withCredentials = true;
27 xhr.onreadystatechange = function() { 28 xhr.onreadystatechange = function() {
28 if (xhr.readyState == 4) { 29 if (xhr.readyState == 4) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 window.setTimeout(feedIq, 1000); 61 window.setTimeout(feedIq, 1000);
61 } else { 62 } else {
62 addToDebugLog('FailedToConnect: --' + xhr.responseText + 63 addToDebugLog('FailedToConnect: --' + xhr.responseText +
63 '-- (status=' + xhr.status + ')'); 64 '-- (status=' + xhr.status + ')');
64 setClientStateMessage('Failed'); 65 setClientStateMessage('Failed');
65 } 66 }
66 } 67 }
67 } 68 }
68 xhr.send('host_jid=' + encodeURIComponent(remoting.hostjid) + 69 xhr.send('host_jid=' + encodeURIComponent(remoting.hostjid) +
69 '&username=' + encodeURIComponent(remoting.username) + 70 '&username=' + encodeURIComponent(remoting.username) +
70 '&password=' + encodeURIComponent(remoting.xmppAuthToken)); 71 '&password=' + encodeURIComponent(remoting.oauth2.getAccessToken()));
71 setClientStateMessage('Connecting'); 72 setClientStateMessage('Connecting');
72 } 73 }
73 74
74 function sendIq(msg) { 75 function sendIq(msg) {
75 addToDebugLog('Sending Iq: ' + msg); 76 addToDebugLog('Sending Iq: ' + msg);
76 77
77 // Extract the top level fields of the Iq packet. 78 // Extract the top level fields of the Iq packet.
78 // TODO(ajwong): Can the plugin just return these fields broken out. 79 // TODO(ajwong): Can the plugin just return these fields broken out.
79 parser = new DOMParser(); 80 parser = new DOMParser();
80 iqNode = parser.parseFromString(msg, 'text/xml').firstChild; 81 iqNode = parser.parseFromString(msg, 'text/xml').firstChild;
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 setClientStateMessage( 311 setClientStateMessage(
311 'Video stats: bandwidth: ' + videoBandwidth.toFixed(2) + 'Kbps' + 312 'Video stats: bandwidth: ' + videoBandwidth.toFixed(2) + 'Kbps' +
312 ', Latency: capture: ' + videoCaptureLatency.toFixed(2) + 'ms' + 313 ', Latency: capture: ' + videoCaptureLatency.toFixed(2) + 'ms' +
313 ', encode: ' + videoEncodeLatency.toFixed(2) + 'ms' + 314 ', encode: ' + videoEncodeLatency.toFixed(2) + 'ms' +
314 ', decode: ' + videoDecodeLatency.toFixed(2) + 'ms' + 315 ', decode: ' + videoDecodeLatency.toFixed(2) + 'ms' +
315 ', render: ' + videoRenderLatency.toFixed(2) + 'ms'); 316 ', render: ' + videoRenderLatency.toFixed(2) + 'ms');
316 317
317 // Update the stats once per second. 318 // Update the stats once per second.
318 window.setTimeout('updateStatusBarStats()', 1000); 319 window.setTimeout('updateStatusBarStats()', 1000);
319 } 320 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698