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 ClientPlugin functionality.
12 /** @suppress {duplicate} */
13 var remoting = remoting || {};
17 * @extends {base.Disposable}
19 remoting.ClientPlugin = function() {};
22 * @return {remoting.HostDesktop}
24 remoting.ClientPlugin.prototype.hostDesktop = function() {};
27 * @return {HTMLElement} The DOM element representing the remote session.
29 remoting.ClientPlugin.prototype.element = function() {};
32 * @param {function(boolean):void} onDone Completion callback.
34 remoting.ClientPlugin.prototype.initialize = function(onDone) {};
37 * @param {string} hostJid The jid of the host to connect to.
38 * @param {string} hostPublicKey The base64 encoded version of the host's
40 * @param {string} localJid Local jid.
41 * @param {string} sharedSecret The access code for IT2Me or the PIN
43 * @param {string} authenticationMethods Comma-separated list of
44 * authentication methods the client should attempt to use.
45 * @param {string} authenticationTag A host-specific tag to mix into
46 * authentication hashes.
47 * @param {string} clientPairingId For paired Me2Me connections, the
48 * pairing id for this client, as issued by the host.
49 * @param {string} clientPairedSecret For paired Me2Me connections, the
50 * paired secret for this client, as issued by the host.
52 remoting.ClientPlugin.prototype.connect = function(
53 hostJid, hostPublicKey, localJid, sharedSecret,
54 authenticationMethods, authenticationTag,
55 clientPairingId, clientPairedSecret) {};
58 * @param {number} key The keycode to inject.
59 * @param {boolean} down True for press; false for a release.
61 remoting.ClientPlugin.prototype.injectKeyEvent =
62 function(key, down) {};
65 * @param {number} from
68 remoting.ClientPlugin.prototype.remapKey = function(from, to) {};
71 * Release all keys currently being pressed.
73 remoting.ClientPlugin.prototype.releaseAllKeys = function() {};
78 remoting.ClientPlugin.prototype.onIncomingIq = function(iq) {};
81 * @return {boolean} True if the web-app and plugin are compatible.
83 remoting.ClientPlugin.prototype.isSupportedVersion = function() {};
86 * @param {remoting.ClientPlugin.Feature} feature
87 * @return {boolean} True if the plugin supports the specified feature.
89 remoting.ClientPlugin.prototype.hasFeature = function(feature) {};
92 * Sends a clipboard item to the host.
94 * @param {string} mimeType The MIME type of the clipboard item.
95 * @param {string} item The clipboard item.
97 remoting.ClientPlugin.prototype.sendClipboardItem =
98 function(mimeType, item) {};
101 * Tell the plugin to request a PIN asynchronously.
103 remoting.ClientPlugin.prototype.useAsyncPinDialog = function() {};
106 * Request that this client be paired with the current host.
108 * @param {string} clientName The human-readable name of the client.
109 * @param {function(string, string):void} onDone Callback to receive the
110 * client id and shared secret when they are available.
112 remoting.ClientPlugin.prototype.requestPairing =
113 function(clientName, onDone) {};
116 * Called when a PIN is obtained from the user.
118 * @param {string} pin The PIN.
120 remoting.ClientPlugin.prototype.onPinFetched = function(pin) {};
123 * Allows automatic mouse-lock.
125 remoting.ClientPlugin.prototype.allowMouseLock = function() {};
128 * Sets the third party authentication token and shared secret.
130 * @param {string} token The token received from the token URL.
131 * @param {string} sharedSecret Shared secret received from the token URL.
133 remoting.ClientPlugin.prototype.onThirdPartyTokenFetched =
134 function(token, sharedSecret) {};
137 * @param {boolean} pause True to pause the audio stream; false to resume it.
139 remoting.ClientPlugin.prototype.pauseAudio = function(pause) {};
142 * @param {boolean} pause True to pause the video stream; false to resume it.
144 remoting.ClientPlugin.prototype.pauseVideo = function(pause) {};
147 * @return {remoting.ClientSession.PerfStats} A summary of the connection
150 remoting.ClientPlugin.prototype.getPerfStats = function() {};
153 * Send an extension message to the host.
155 * @param {string} name
156 * @param {string} data
158 remoting.ClientPlugin.prototype.sendClientMessage =
159 function(name, data) {};
162 * @param {function(string):void} handler Callback for sending an IQ stanza.
164 remoting.ClientPlugin.prototype.setOnOutgoingIqHandler =
165 function(handler) {};
168 * @param {function(string):void} handler Callback for logging debug messages.
170 remoting.ClientPlugin.prototype.setOnDebugMessageHandler =
171 function(handler) {};
174 * @param {function(number, number):void} handler Callback for connection status
175 * update notifications. The first parameter is the connection state; the
176 * second is the error code, if any.
178 remoting.ClientPlugin.prototype.setConnectionStatusUpdateHandler =
179 function(handler) {};
182 * @param {function(string, string):void} handler Callback for route-change
183 * notifications. The first parameter is the channel name, and the second
184 * is the connection type.
186 remoting.ClientPlugin.prototype.setRouteChangedHandler = function(handler) {};
189 * @param {function(boolean):void} handler Callback for connection readiness
192 remoting.ClientPlugin.prototype.setConnectionReadyHandler =
193 function(handler) {};
196 * @param {function(!Array<string>):void} handler Callback to inform of
197 * capabilities negotiated between host and client.
199 remoting.ClientPlugin.prototype.setCapabilitiesHandler =
200 function(handler) {};
203 * @param {function(string):void} handler Callback for processing security key
204 * (Gnubby) protocol messages.
206 remoting.ClientPlugin.prototype.setGnubbyAuthHandler =
207 function(handler) {};
210 * @param {function(string):void} handler Callback for processing Cast protocol
213 remoting.ClientPlugin.prototype.setCastExtensionHandler =
214 function(handler) {};
217 * @param {function(string, number, number):void} handler Callback for
218 * processing large mouse cursor images. The first parameter is a data:
219 * URL encoding the mouse cursor; the second and third parameters are
220 * the cursor hotspot's x- and y-coordinates, respectively.
222 remoting.ClientPlugin.prototype.setMouseCursorHandler =
223 function(handler) {};
226 * @param {function(string, string, string):void} handler Callback for
227 * fetching third-party tokens. The first parameter is the token URL; the
228 * second is the public key of the host; the third is the OAuth2 scope
231 remoting.ClientPlugin.prototype.setFetchThirdPartyTokenHandler =
232 function(handler) {};
235 * @param {function(boolean):void} handler Callback for fetching a PIN from
236 * the user. The parameter is true if PIN pairing is supported by the
237 * host, or false otherwise.
239 remoting.ClientPlugin.prototype.setFetchPinHandler =
240 function(handler) {};
243 * @param {function({rects:Array<Array<number>>}):void|null} handler Callback
244 * to receive dirty region information for each video frame, for debugging.
246 remoting.ClientPlugin.prototype.setDebugDirtyRegionHandler =
247 function(handler) {};
251 * Set of features for which hasFeature() can be used to test.
255 remoting.ClientPlugin.Feature = {
256 INJECT_KEY_EVENT: 'injectKeyEvent',
257 NOTIFY_CLIENT_RESOLUTION: 'notifyClientResolution',
258 ASYNC_PIN: 'asyncPin',
259 PAUSE_VIDEO: 'pauseVideo',
260 PAUSE_AUDIO: 'pauseAudio',
261 REMAP_KEY: 'remapKey',
262 SEND_CLIPBOARD_ITEM: 'sendClipboardItem',
263 THIRD_PARTY_AUTH: 'thirdPartyAuth',
265 PINLESS_AUTH: 'pinlessAuth',
266 ALLOW_MOUSE_LOCK: 'allowMouseLock',
267 EXTENSION_MESSAGE: 'extensionMessage',
268 VIDEO_CONTROL: 'videoControl'
275 remoting.ClientPluginFactory = function() {};
278 * @param {Element} container The container for the embed element.
279 * @param {function(string, string):boolean} onExtensionMessage The handler for
280 * protocol extension messages. Returns true if a message is recognized;
282 * @param {Array<string>} requiredCapabilities
283 * @return {remoting.ClientPlugin} A new client plugin instance.
285 remoting.ClientPluginFactory.prototype.createPlugin =
286 function(container, onExtensionMessage, requiredCapabilities) {};
289 * Preload the plugin to make instantiation faster when the user tries
292 remoting.ClientPluginFactory.prototype.preloadPlugin = function() {};
295 * @type {remoting.ClientPluginFactory}
297 remoting.ClientPlugin.factory = null;