Upstream version 11.39.266.0
[platform/framework/web/crosswalk.git] / src / remoting / webapp / session_connector.js
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.
4
5 /**
6  * @fileoverview
7  * Interface abstracting the SessionConnector functionality.
8  */
9
10 'use strict';
11
12 /** @suppress {duplicate} */
13 var remoting = remoting || {};
14
15 /**
16  * @interface
17  */
18 remoting.SessionConnector = function() {};
19
20 /**
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.
23  */
24 remoting.SessionConnector.prototype.reset = function() {};
25
26 /**
27  * Initiate a Me2Me connection.
28  *
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  *     authenticaiton 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.
41  */
42 remoting.SessionConnector.prototype.connectMe2Me =
43     function(host, fetchPin, fetchThirdPartyToken,
44              clientPairingId, clientPairedSecret) {};
45
46 /**
47  * Update the pairing info so that the reconnect function will work correctly.
48  *
49  * @param {string} clientId The paired client id.
50  * @param {string} sharedSecret The shared secret.
51  */
52 remoting.SessionConnector.prototype.updatePairingInfo =
53     function(clientId, sharedSecret) {};
54
55 /**
56  * Initiate an IT2Me connection.
57  *
58  * @param {string} accessCode The access code as entered by the user.
59  * @return {void} Nothing.
60  */
61 remoting.SessionConnector.prototype.connectIT2Me =
62     function(accessCode) {};
63
64 /**
65  * Reconnect a closed connection.
66  *
67  * @return {void} Nothing.
68  */
69 remoting.SessionConnector.prototype.reconnect = function() {};
70
71 /**
72  * Cancel a connection-in-progress.
73  */
74 remoting.SessionConnector.prototype.cancel = function() {};
75
76 /**
77  * Get the connection mode (Me2Me or IT2Me)
78  *
79  * @return {remoting.ClientSession.Mode}
80  */
81 remoting.SessionConnector.prototype.getConnectionMode = function() {};
82
83 /**
84  * Get host ID.
85  *
86  * @return {string}
87  */
88 remoting.SessionConnector.prototype.getHostId = function() {};
89
90
91 /**
92  * @interface
93  */
94 remoting.SessionConnectorFactory = function() {};
95
96 /**
97  * @param {HTMLElement} clientContainer Container element for the client view.
98  * @param {function(remoting.ClientSession):void} onConnected Callback on
99  *     success.
100  * @param {function(remoting.Error):void} onError Callback on error.
101  * @param {function(string, string):boolean} onExtensionMessage The handler for
102  *     protocol extension messages. Returns true if a message is recognized;
103  *     false otherwise.
104  * @return {remoting.SessionConnector}
105  */
106 remoting.SessionConnectorFactory.prototype.createConnector =
107     function(clientContainer, onConnected, onError, onExtensionMessage) {};
108
109 /**
110  * @type {remoting.SessionConnectorFactory}
111  */
112 remoting.SessionConnector.factory = null;