Index: remoting/webapp/crd/js/it2me_activity.js |
diff --git a/remoting/webapp/crd/js/it2me_activity.js b/remoting/webapp/crd/js/it2me_activity.js |
index e5dc2db7054fd81abae923b92e42c8235e69db7c..d12d993e98048ceb30142f488e971dcce7936ee8 100644 |
--- a/remoting/webapp/crd/js/it2me_activity.js |
+++ b/remoting/webapp/crd/js/it2me_activity.js |
@@ -44,8 +44,11 @@ remoting.It2MeActivity.prototype.dispose = function() { |
remoting.It2MeActivity.prototype.start = function() { |
var that = this; |
+ this.desktopActivity_ = new remoting.DesktopRemotingActivity(this); |
+ remoting.app.setConnectionMode(remoting.Application.Mode.IT2ME); |
+ |
this.accessCodeDialog_.show().then(function(/** string */ accessCode) { |
- remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); |
+ that.desktopActivity_.getConnectingDialog().show(); |
return that.verifyAccessCode_(accessCode); |
}).then(function() { |
return remoting.identity.getToken(); |
@@ -55,7 +58,7 @@ remoting.It2MeActivity.prototype.start = function() { |
return that.onHostInfo_(response); |
}).then(function(/** remoting.Host */ host) { |
that.connect_(host); |
- }).catch(function(/** remoting.Error */ error) { |
+ }).catch(remoting.Error.handler(function(/** remoting.Error */ error) { |
if (error.hasTag(remoting.Error.Tag.CANCELLED)) { |
remoting.setMode(remoting.AppMode.HOME); |
} else { |
@@ -63,7 +66,7 @@ remoting.It2MeActivity.prototype.start = function() { |
l10n.localizeElementFromTag(errorDiv, error.getTag()); |
remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); |
} |
- }); |
+ })); |
}; |
remoting.It2MeActivity.prototype.stop = function() { |
@@ -86,6 +89,8 @@ remoting.It2MeActivity.prototype.onConnected = function(connectionInfo) { |
remoting.It2MeActivity.prototype.onDisconnected = function() { |
this.showFinishDialog_(remoting.AppMode.CLIENT_SESSION_FINISHED_IT2ME); |
+ base.dispose(this.desktopActivity_); |
+ this.desktopActivity_ = null; |
}; |
/** |
@@ -95,6 +100,9 @@ remoting.It2MeActivity.prototype.onError = function(error) { |
var errorDiv = document.getElementById('connect-error-message'); |
l10n.localizeElementFromTag(errorDiv, error.getTag()); |
this.showFinishDialog_(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); |
+ |
+ base.dispose(this.desktopActivity_); |
+ this.desktopActivity_ = null; |
}; |
/** @return {remoting.DesktopRemotingActivity} */ |
@@ -183,9 +191,6 @@ remoting.It2MeActivity.prototype.onHostInfo_ = function(xhrResponse) { |
* @private |
*/ |
remoting.It2MeActivity.prototype.connect_ = function(host) { |
- base.dispose(this.desktopActivity_); |
- this.desktopActivity_ = new remoting.DesktopRemotingActivity(this); |
- remoting.app.setConnectionMode(remoting.Application.Mode.IT2ME); |
this.desktopActivity_.start( |
host, new remoting.CredentialsProvider({ accessCode: this.passCode_ })); |
}; |