Index: remoting/webapp/app_remoting/js/app_remoting_activity.js |
diff --git a/remoting/webapp/app_remoting/js/app_remoting_activity.js b/remoting/webapp/app_remoting/js/app_remoting_activity.js |
index 3685946ef08a53ce7e2dbca4c2477df1278ae859..fecd55d55bf37f7d98addd5fabc9d3f0172e745a 100644 |
--- a/remoting/webapp/app_remoting/js/app_remoting_activity.js |
+++ b/remoting/webapp/app_remoting/js/app_remoting_activity.js |
@@ -35,9 +35,9 @@ remoting.AppRemotingActivity = function(appCapabilities) { |
this.connectedView_ = null; |
/** @private */ |
- this.connector_ = remoting.SessionConnector.factory.createConnector( |
- document.getElementById('client-container'), appCapabilities, |
- this); |
+ this.sessionFactory_ = new remoting.ClientSessionFactory( |
+ document.querySelector('#client-container .client-plugin-container'), |
+ appCapabilities); |
/** @private {remoting.ClientSession} */ |
this.session_ = null; |
@@ -69,6 +69,7 @@ remoting.AppRemotingActivity.prototype.stop = function() { |
remoting.AppRemotingActivity.prototype.cleanup_ = function() { |
base.dispose(this.connectedView_); |
this.connectedView_ = null; |
+ base.dispose(this.session_); |
this.session_ = null; |
}; |
@@ -127,11 +128,17 @@ remoting.AppRemotingActivity.prototype.onAppHostResponse_ = |
host['sharedSecret']); |
}; |
- this.connector_.connect( |
- remoting.Application.Mode.APP_REMOTING, host, |
- new remoting.CredentialsProvider( |
- {fetchThirdPartyToken: fetchThirdPartyToken})); |
- |
+ remoting.app.setConnectionMode(remoting.Application.Mode.APP_REMOTING); |
+ var credentialsProvider = new remoting.CredentialsProvider( |
+ {fetchThirdPartyToken: fetchThirdPartyToken}); |
+ var that = this; |
+ |
+ this.sessionFactory_.createSession(this).then( |
+ function(/** remoting.ClientSession */ session) { |
+ that.session_ = session; |
+ session.logHostOfflineErrors(true); |
+ session.connect(host, credentialsProvider); |
+ }); |
} else if (response && response.status == 'pending') { |
this.onError(new remoting.Error( |
remoting.Error.Tag.SERVICE_UNAVAILABLE)); |
@@ -149,7 +156,6 @@ remoting.AppRemotingActivity.prototype.onConnected = function(connectionInfo) { |
this.connectedView_ = new remoting.AppConnectedView( |
document.getElementById('client-container'), connectionInfo); |
- this.session_ = connectionInfo.session(); |
var idleDetector = new remoting.IdleDetector( |
document.getElementById('idle-dialog'), this.stop.bind(this)); |