1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 * Interface abstracting the SessionConnector functionality.
12 /** @suppress {duplicate} */
13 var remoting = remoting || {};
18 remoting.SessionConnector = function() {};
21 * Reset the per-connection state so that the object can be re-used for a
22 * second connection. Note the none of the shared WCS state is reset.
24 remoting.SessionConnector.prototype.reset = function() {};
27 * Initiate a Me2Me connection.
29 * @param {remoting.Host} host The Me2Me host to which to connect.
30 * @param {function(boolean, function(string):void):void} fetchPin Function to
31 * interactively obtain the PIN from the user.
32 * @param {function(string, string, string,
33 * function(string, string): void): void}
34 * fetchThirdPartyToken Function to obtain a token from a third party
35 * authentication server.
36 * @param {string} clientPairingId The client id issued by the host when
37 * this device was paired, if it is already paired.
38 * @param {string} clientPairedSecret The shared secret issued by the host when
39 * this device was paired, if it is already paired.
40 * @return {void} Nothing.
42 remoting.SessionConnector.prototype.connectMe2Me =
43 function(host, fetchPin, fetchThirdPartyToken,
44 clientPairingId, clientPairedSecret) {};
47 * Retry connecting to a Me2Me host after a connection failure.
49 * @param {remoting.Host} host The Me2Me host to refresh.
50 * @return {void} Nothing.
52 remoting.SessionConnector.prototype.retryConnectMe2Me = function(host) {};
55 * Initiate a Me2App connection.
57 * @param {remoting.Host} host The Me2Me host to which to connect.
58 * @param {function(string, string, string,
59 * function(string, string): void): void}
60 * fetchThirdPartyToken Function to obtain a token from a third party
61 * authentication server.
62 * @return {void} Nothing.
64 remoting.SessionConnector.prototype.connectMe2App =
65 function(host, fetchThirdPartyToken) {};
68 * Update the pairing info so that the reconnect function will work correctly.
70 * @param {string} clientId The paired client id.
71 * @param {string} sharedSecret The shared secret.
73 remoting.SessionConnector.prototype.updatePairingInfo =
74 function(clientId, sharedSecret) {};
77 * Initiate an IT2Me connection.
79 * @param {string} accessCode The access code as entered by the user.
80 * @return {void} Nothing.
82 remoting.SessionConnector.prototype.connectIT2Me =
83 function(accessCode) {};
86 * Reconnect a closed connection.
88 * @return {void} Nothing.
90 remoting.SessionConnector.prototype.reconnect = function() {};
93 * Cancel a connection-in-progress.
95 remoting.SessionConnector.prototype.cancel = function() {};
98 * Get the connection mode (Me2Me or IT2Me)
100 * @return {remoting.DesktopConnectedView.Mode}
102 remoting.SessionConnector.prototype.getConnectionMode = function() {};
109 remoting.SessionConnector.prototype.getHostId = function() {};
115 remoting.SessionConnectorFactory = function() {};
118 * @param {HTMLElement} clientContainer Container element for the client view.
119 * @param {function(remoting.ClientSession):void} onConnected Callback on
121 * @param {function(remoting.Error):void} onError Callback on error.
122 * @param {function(string, string):boolean} onExtensionMessage The handler for
123 * protocol extension messages. Returns true if a message is recognized;
125 * @param {function(remoting.Error):void} onConnectionFailed Callback for when
126 * the connection fails.
127 * @param {Array<string>} requiredCapabilities Connector capabilities
128 * required by this application.
129 * @param {string} defaultRemapKeys The default set of key mappings to use
130 * in the client session.
131 * @return {remoting.SessionConnector}
133 remoting.SessionConnectorFactory.prototype.createConnector =
134 // TODO(garykac): Can onExtensionMessage be removed from here? It's only
135 // needed to pass to the ClientSession. Investigate why ClientSession
137 function(clientContainer, onConnected, onError, onExtensionMessage,
138 onConnectionFailed, requiredCapabilities, defaultRemapKeys) {};
141 * @type {remoting.SessionConnectorFactory}
143 remoting.SessionConnector.factory = null;