Index: remoting/webapp/crd/js/me2me_activity.js |
diff --git a/remoting/webapp/crd/js/me2me_activity.js b/remoting/webapp/crd/js/me2me_activity.js |
index 7d2b090e1b6095b86fdb3fa4ebd46ff7ca05bacb..d71f07f0cb5cccbb5f24685f22903b63bcb2a79a 100644 |
--- a/remoting/webapp/crd/js/me2me_activity.js |
+++ b/remoting/webapp/crd/js/me2me_activity.js |
@@ -11,14 +11,17 @@ var remoting = remoting || {}; |
/** |
* @param {remoting.Host} host |
+ * @param {remoting.HostList} hostList |
* |
* @constructor |
* @implements {remoting.Activity} |
*/ |
-remoting.Me2MeActivity = function(host) { |
+remoting.Me2MeActivity = function(host, hostList) { |
/** @private */ |
this.host_ = host; |
/** @private */ |
+ this.hostList_ = hostList; |
+ /** @private */ |
this.pinDialog_ = |
new remoting.PinDialog(document.getElementById('pin-dialog'), host); |
/** @private */ |
@@ -48,11 +51,11 @@ remoting.Me2MeActivity.prototype.start = function() { |
return that.host_.options.load(); |
}).then(function() { |
that.connect_(true); |
- }).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); |
} |
- }); |
+ })); |
}; |
remoting.Me2MeActivity.prototype.stop = function() { |
@@ -69,9 +72,9 @@ remoting.Me2MeActivity.prototype.getDesktopActivity = function() { |
* @private |
*/ |
remoting.Me2MeActivity.prototype.connect_ = function(suppressHostOfflineError) { |
- remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); |
base.dispose(this.desktopActivity_); |
this.desktopActivity_ = new remoting.DesktopRemotingActivity(this); |
+ this.desktopActivity_.getConnectingDialog().show(); |
remoting.app.setConnectionMode(remoting.Application.Mode.ME2ME); |
this.desktopActivity_.start(this.host_, this.createCredentialsProvider_(), |
suppressHostOfflineError); |
@@ -104,13 +107,15 @@ remoting.Me2MeActivity.prototype.createCredentialsProvider_ = function() { |
* @param {function(string):void} onPinFetched |
*/ |
var requestPin = function(supportsPairing, onPinFetched) { |
+ that.desktopActivity_.getConnectingDialog().hide(); |
that.pinDialog_.show(supportsPairing).then(function(/** string */ pin) { |
- remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); |
+ that.desktopActivity_.getConnectingDialog().show(); |
onPinFetched(pin); |
- }).catch(function(/** remoting.Error */ error) { |
+ }).catch(remoting.Error.handler(function(/** remoting.Error */ error) { |
base.debug.assert(error.hasTag(remoting.Error.Tag.CANCELLED)); |
remoting.setMode(remoting.AppMode.HOME); |
- }); |
+ that.stop(); |
+ })); |
}; |
return new remoting.CredentialsProvider({ |
@@ -131,7 +136,7 @@ remoting.Me2MeActivity.prototype.onConnectionFailed = function(error) { |
var onHostListRefresh = function(/** boolean */ success) { |
if (success) { |
// Get the host from the hostList for the refreshed JID. |
- that.host_ = remoting.hostList.getHostForId(that.host_.hostId); |
+ that.host_ = that.hostList_.getHostForId(that.host_.hostId); |
that.connect_(false); |
return; |
} |
@@ -141,9 +146,12 @@ remoting.Me2MeActivity.prototype.onConnectionFailed = function(error) { |
// The plugin will be re-created when the host finished refreshing |
remoting.hostList.refresh(onHostListRefresh); |
Jamie
2015/04/24 17:59:18
this.hostList_?
kelvinp
2015/04/24 19:03:52
Done.
|
- } else { |
+ } else if (!error.isNone()) { |
this.onError(error); |
} |
+ |
+ base.dispose(this.desktopActivity_); |
+ this.desktopActivity_ = null; |
}; |
/** |
@@ -162,6 +170,7 @@ remoting.Me2MeActivity.prototype.onConnected = function(connectionInfo) { |
base.dispose(this.reconnector_); |
this.reconnector_ = new remoting.SmartReconnector( |
+ this.desktopActivity_.getConnectingDialog(), |
this.connect_.bind(this, false), |
this.stop.bind(this), |
connectionInfo.session()); |
@@ -201,6 +210,9 @@ remoting.Me2MeActivity.prototype.showFinishDialog_ = function(mode) { |
that.connect_(true); |
} |
}); |
+ |
+ base.dispose(this.desktopActivity_); |
+ this.desktopActivity_ = null; |
}; |
/** |