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

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

Issue 7511001: Don't transition to in-session mode until the connection has been established. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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
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 var remoting = remoting || {}; 5 var remoting = remoting || {};
6 6
7 (function() { 7 (function() {
8 'use strict'; 8 'use strict';
9 9
10 window.addEventListener('blur', pluginLostFocus_, false); 10 window.addEventListener('blur', pluginLostFocus_, false);
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 setClientStateMessage('Connecting as ' + remoting.username); 451 setClientStateMessage('Connecting as ' + remoting.username);
452 } else if (state == remoting.ClientSession.State.INITIALIZING) { 452 } else if (state == remoting.ClientSession.State.INITIALIZING) {
453 setClientStateMessage('Initializing connection'); 453 setClientStateMessage('Initializing connection');
454 } else if (state == remoting.ClientSession.State.CONNECTED) { 454 } else if (state == remoting.ClientSession.State.CONNECTED) {
455 var split = remoting.hostJid.split('/'); 455 var split = remoting.hostJid.split('/');
456 var host = null; 456 var host = null;
457 if (split.length == 2) { 457 if (split.length == 2) {
458 host = split[0]; 458 host = split[0];
459 } 459 }
460 setClientStateMessage('Connected to', host); 460 setClientStateMessage('Connected to', host);
461 setGlobalMode(remoting.AppMode.IN_SESSION);
461 updateStatistics(); 462 updateStatistics();
462 } else if (state == remoting.ClientSession.State.CLOSED) { 463 } else if (state == remoting.ClientSession.State.CLOSED) {
463 setClientStateMessage('Closed'); 464 setClientStateMessage('Closed');
465 if (remoting.session.state != remoting.ClientSession.State.CONNECTED) {
466 showConnectError_(404);
Jamie 2011/07/25 23:09:50 This is not quite correct, as it will report "Inva
awong 2011/07/26 18:51:27 Add TODO?
Jamie 2011/07/26 19:02:35 Done.
467 }
464 } else if (state == remoting.ClientSession.State.CONNECTION_FAILED) { 468 } else if (state == remoting.ClientSession.State.CONNECTION_FAILED) {
465 setClientStateMessage('Failed'); 469 setClientStateMessage('Failed');
466 } else { 470 } else {
467 setClientStateMessage('Bad State: ' + state); 471 setClientStateMessage('Bad State: ' + state);
468 } 472 }
469 } 473 }
470 474
471 function startSession_() { 475 function startSession_() {
472 remoting.debug.log('Starting session...'); 476 remoting.debug.log('Starting session...');
473 remoting.username = getEmail(); 477 remoting.username = getEmail();
474 setGlobalMode(remoting.AppMode.IN_SESSION);
475 remoting.session = 478 remoting.session =
476 new remoting.ClientSession(remoting.hostJid, remoting.hostPublicKey, 479 new remoting.ClientSession(remoting.hostJid, remoting.hostPublicKey,
477 remoting.accessCode, getEmail(), 480 remoting.accessCode, getEmail(),
478 onClientStateChange_); 481 onClientStateChange_);
479 remoting.oauth2.callWithToken(function(token) { 482 remoting.oauth2.callWithToken(function(token) {
480 remoting.session.createPluginAndConnect( 483 remoting.session.createPluginAndConnect(
481 document.getElementById('session-mode'), 484 document.getElementById('session-mode'),
482 token); 485 token);
483 }); 486 });
484 } 487 }
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 remoting.session = null; 635 remoting.session = null;
633 remoting.debug.log('Disconnected.'); 636 remoting.debug.log('Disconnected.');
634 remoting.setClientMode('unconnected'); 637 remoting.setClientMode('unconnected');
635 var accessCode = document.getElementById('access-code-entry'); 638 var accessCode = document.getElementById('access-code-entry');
636 accessCode.value = ''; 639 accessCode.value = '';
637 setGlobalMode(remoting.AppMode.CLIENT); 640 setGlobalMode(remoting.AppMode.CLIENT);
638 } 641 }
639 } 642 }
640 643
641 }()); 644 }());
OLDNEW
« remoting/webapp/me2mom/client_session.js ('K') | « remoting/webapp/me2mom/client_session.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698