Index: remoting/webapp/crd/js/desktop_remoting_activity.js |
diff --git a/remoting/webapp/crd/js/desktop_remoting_activity.js b/remoting/webapp/crd/js/desktop_remoting_activity.js |
index 369b2281ee925c8a63fdec60c6708f62ac931346..1e64621ea129d48a1df16b40c2a092eedb5ae492 100644 |
--- a/remoting/webapp/crd/js/desktop_remoting_activity.js |
+++ b/remoting/webapp/crd/js/desktop_remoting_activity.js |
@@ -24,10 +24,33 @@ remoting.DesktopRemotingActivity = function(parentActivity) { |
this.parentActivity_ = parentActivity; |
/** @private {remoting.DesktopConnectedView} */ |
this.connectedView_ = null; |
+ /** @private */ |
+ this.sessionFactory_ = new remoting.ClientSessionFactory( |
+ document.querySelector('#client-container .client-plugin-container'), |
+ remoting.app_capabilities()); |
/** @private {remoting.ClientSession} */ |
this.session_ = null; |
}; |
+/** |
+ * Initiates a connection. |
+ * |
+ * @param {remoting.Host} host the Host to connect to. |
+ * @param {remoting.CredentialsProvider} credentialsProvider |
+ * @param {boolean=} opt_suppressOfflineError |
+ * @return {void} Nothing. |
+ */ |
+remoting.DesktopRemotingActivity.prototype.start = |
+ function(host, credentialsProvider, opt_suppressOfflineError) { |
+ var that = this; |
+ this.sessionFactory_.createSession(this).then( |
+ function(/** remoting.ClientSession */ session) { |
+ that.session_ = session; |
+ session.logHostOfflineErrors(!opt_suppressOfflineError); |
+ session.connect(host, credentialsProvider); |
+ }); |
+}; |
+ |
remoting.DesktopRemotingActivity.prototype.stop = function() { |
if (this.session_) { |
this.session_.disconnect(remoting.Error.none()); |
@@ -46,8 +69,6 @@ remoting.DesktopRemotingActivity.prototype.onConnected = |
remoting.toolbar.preview(); |
} |
- this.session_ = connectionInfo.session(); |
- |
this.connectedView_ = new remoting.DesktopConnectedView( |
document.getElementById('client-container'), connectionInfo); |
@@ -100,6 +121,7 @@ remoting.DesktopRemotingActivity.prototype.onError = function(error) { |
remoting.DesktopRemotingActivity.prototype.dispose = function() { |
base.dispose(this.connectedView_); |
this.connectedView_ = null; |
+ base.dispose(this.session_); |
this.session_ = null; |
}; |