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

Unified 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: Rebase Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/webapp/me2mom/client_session.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/me2mom/remoting.js
diff --git a/remoting/webapp/me2mom/remoting.js b/remoting/webapp/me2mom/remoting.js
index 8433a90e62a830db87c6b514668365a67ce27297..695bb84f63296537e81cbd8f9151cd64cd271e90 100644
--- a/remoting/webapp/me2mom/remoting.js
+++ b/remoting/webapp/me2mom/remoting.js
@@ -438,7 +438,8 @@ function updateStatistics() {
window.setTimeout(updateStatistics, 1000);
}
-function onClientStateChange_(state) {
+function onClientStateChange_(oldState) {
+ var state = remoting.session.state;
if (state == remoting.ClientSession.State.UNKNOWN) {
setClientStateMessage('Unknown');
} else if (state == remoting.ClientSession.State.CREATED) {
@@ -458,9 +459,16 @@ function onClientStateChange_(state) {
host = split[0];
}
setClientStateMessage('Connected to', host);
+ setGlobalMode(remoting.AppMode.IN_SESSION);
updateStatistics();
} else if (state == remoting.ClientSession.State.CLOSED) {
setClientStateMessage('Closed');
+ if (oldState != remoting.ClientSession.State.CONNECTED) {
+ // TODO(jamiewalch): This is not quite correct, as it will report
+ // "Invalid access code", regardless of what actually went wrong.
+ // Fix this up by having the host send a suitable error code.
+ showConnectError_(404);
+ }
} else if (state == remoting.ClientSession.State.CONNECTION_FAILED) {
setClientStateMessage('Failed');
} else {
@@ -471,7 +479,6 @@ function onClientStateChange_(state) {
function startSession_() {
remoting.debug.log('Starting session...');
remoting.username = getEmail();
- setGlobalMode(remoting.AppMode.IN_SESSION);
remoting.session =
new remoting.ClientSession(remoting.hostJid, remoting.hostPublicKey,
remoting.accessCode, getEmail(),
« no previous file with comments | « remoting/webapp/me2mom/client_session.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698