Chromium Code Reviews| 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 c05d2192eacb686fc45c9f4e50638416754d38e7..a07c36e38dfe85046add12b5116e72046c889d4a 100644 |
| --- a/remoting/webapp/crd/js/it2me_activity.js |
| +++ b/remoting/webapp/crd/js/it2me_activity.js |
| @@ -46,28 +46,39 @@ remoting.It2MeActivity.prototype.dispose = function() { |
| remoting.It2MeActivity.prototype.start = function() { |
| var that = this; |
| + var SessionState = remoting.ChromotingEvent.SessionState; |
| this.logger_ = this.createLogger_(); |
| - this.logger_.logSessionStateChange( |
| - remoting.ChromotingEvent.SessionState.STARTED); |
| + this.logger_.logSessionStateChange(SessionState.STARTED); |
| + base.dispose(this.desktopActivity_); |
|
Jamie
2015/11/09 18:16:45
Do you ever expect desktopActivity to be non-null?
|
| this.desktopActivity_ = |
| new remoting.DesktopRemotingActivity(this, this.logger_); |
| + function onError(/** remoting.Error */ error) { |
| + if (error.isCancel()) { |
| + that.logger_.logSessionStateChange(SessionState.CONNECTION_CANCELED); |
| + remoting.setMode(remoting.AppMode.HOME); |
| + } else { |
| + that.logger_.logSessionStateChange(SessionState.CONNECTION_FAILED, error); |
| + that.showErrorMessage_(error); |
| + } |
| + |
| + base.dispose(that.desktopActivity_); |
| + that.desktopActivity_ = null; |
| + } |
| + |
| + var sessionStart = Date.now(); |
| + |
| this.accessCodeDialog_.show().then(function(/** string */ accessCode) { |
| + that.logger_.setAuthTotalTime(Date.now() - sessionStart); |
| that.desktopActivity_.getConnectingDialog().show(); |
| return that.verifyAccessCode_(accessCode); |
| }).then(function() { |
| return remoting.HostListApi.getInstance().getSupportHost(that.hostId_); |
| }).then(function(/** remoting.Host */ host) { |
| that.connect_(host); |
| - }).catch(remoting.Error.handler(function(/** remoting.Error */ error) { |
| - if (error.hasTag(remoting.Error.Tag.CANCELLED)) { |
| - remoting.setMode(remoting.AppMode.HOME); |
| - } else { |
| - that.showErrorMessage_(error); |
| - } |
| - })); |
| + }).catch(remoting.Error.handler(onError)); |
| }; |