Index: remoting/webapp/crd/js/client_session.js |
diff --git a/remoting/webapp/crd/js/client_session.js b/remoting/webapp/crd/js/client_session.js |
index 12260801fad8053d2e6fb0a655279b660e8628ca..c4af96b28305e6827bd4090abbe1ee57d4be8529 100644 |
--- a/remoting/webapp/crd/js/client_session.js |
+++ b/remoting/webapp/crd/js/client_session.js |
@@ -92,10 +92,48 @@ remoting.ClientSession = function(plugin, host, signalStrategy, |
/** @enum {string} */ |
remoting.ClientSession.Events = { |
- stateChanged: 'stateChanged', |
+ stateChanged: 'stateChanged', // deprecated. |
videoChannelStateChanged: 'videoChannelStateChanged', |
}; |
+/** |
+ * @interface |
+ * [START]-------> [onConnected] ------> [onDisconnected] |
+ * | | |
+ * |-----> [OnConnectionFailed] |----> [onError] |
+ * |
+ * TODO(kelvinp): Route session state changes through this interface. |
+ */ |
+remoting.ClientSession.EventHandler = function() {}; |
+ |
+/** |
+ * Called when the connection failed before it is connected. |
+ * |
+ * @param {!remoting.Error} error |
+ */ |
+remoting.ClientSession.EventHandler.prototype.onConnectionFailed = |
+ function(error) {}; |
+ |
+/** |
+ * Called when a new session has been connected. The |connectionInfo| will be |
+ * valid until onDisconnected() or onError() is called. |
+ * |
+ * @param {!remoting.ConnectionInfo} connectionInfo |
+ */ |
+remoting.ClientSession.EventHandler.prototype.onConnected = |
+ function(connectionInfo) {}; |
+ |
+/** |
+ * Called when the current session has been disconnected. |
+ */ |
+remoting.ClientSession.EventHandler.prototype.onDisconnected = function() {}; |
+ |
+/** |
+ * Called when an error needs to be displayed to the user. |
+ * @param {!remoting.Error} error |
+ */ |
+remoting.ClientSession.EventHandler.prototype.onError = function(error) {}; |
+ |
// Note that the positive values in both of these enums are copied directly |
// from connection_to_host.h and must be kept in sync. Code in |
// chromoting_instance.cc converts the C++ enums into strings that must match |
@@ -544,19 +582,6 @@ remoting.ClientSession.prototype.logHostOfflineErrors = function(enable) { |
}; |
/** |
- * Request pairing with the host for PIN-less authentication. |
- * |
- * @param {string} clientName The human-readable name of the client. |
- * @param {function(string, string):void} onDone Callback to receive the |
- * client id and shared secret when they are available. |
- */ |
-remoting.ClientSession.prototype.requestPairing = function(clientName, onDone) { |
- if (this.plugin_) { |
- this.plugin_.requestPairing(clientName, onDone); |
- } |
-}; |
- |
-/** |
* Sends a clipboard item to the host. |
* |
* @param {string} mimeType The MIME type of the clipboard item. |