1 // Copyright (c) 2012 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.
5 /** @suppress {duplicate} */
6 var remoting = remoting || {};
9 * Interface used for ClientPlugin objects.
12 remoting.ClientPlugin = function() {
15 /** @type {number} Desktop width */
16 remoting.ClientPlugin.prototype.desktopWidth;
17 /** @type {number} Desktop height */
18 remoting.ClientPlugin.prototype.desktopHeight;
19 /** @type {number} Desktop x DPI */
20 remoting.ClientPlugin.prototype.desktopXDpi;
21 /** @type {number} Desktop y DPI */
22 remoting.ClientPlugin.prototype.desktopYDpi;
24 /** @type {function(string): void} Outgoing signaling message callback. */
25 remoting.ClientPlugin.prototype.onOutgoingIqHandler;
26 /** @type {function(string): void} Debug messages callback. */
27 remoting.ClientPlugin.prototype.onDebugMessageHandler;
28 /** @type {function(number, number): void} State change callback. */
29 remoting.ClientPlugin.prototype.onConnectionStatusUpdateHandler;
30 /** @type {function(boolean): void} Connection ready state callback. */
31 remoting.ClientPlugin.prototype.onConnectionReadyHandler;
32 /** @type {function(): void} Desktop size change callback. */
33 remoting.ClientPlugin.prototype.onDesktopSizeUpdateHandler;
34 /** @type {function(!Array.<string>): void} Capabilities negotiated callback. */
35 remoting.ClientPlugin.prototype.onSetCapabilitiesHandler;
36 /** @type {function(boolean): void} Request a PIN from the user. */
37 remoting.ClientPlugin.prototype.fetchPinHandler;
40 * Initializes the plugin asynchronously and calls specified function
43 * @param {function(boolean): void} onDone Function to be called when
44 * the plugin is initialized. Parameter is set to true when the plugin
45 * is loaded successfully.
47 remoting.ClientPlugin.prototype.initialize = function(onDone) {};
50 * @return {boolean} True if the plugin and web-app versions are compatible.
52 remoting.ClientPlugin.prototype.isSupportedVersion = function() {};
55 * Set of features for which hasFeature() can be used to test.
59 remoting.ClientPlugin.Feature = {
60 INJECT_KEY_EVENT: 'injectKeyEvent',
61 NOTIFY_CLIENT_RESOLUTION: 'notifyClientResolution',
62 ASYNC_PIN: 'asyncPin',
63 PAUSE_VIDEO: 'pauseVideo',
64 PAUSE_AUDIO: 'pauseAudio',
65 REMAP_KEY: 'remapKey',
66 SEND_CLIPBOARD_ITEM: 'sendClipboardItem',
67 THIRD_PARTY_AUTH: 'thirdPartyAuth',
69 PINLESS_AUTH: 'pinlessAuth',
70 EXTENSION_MESSAGE: 'extensionMessage'
74 * @param {remoting.ClientPlugin.Feature} feature The feature to test for.
75 * @return {boolean} True if the plugin supports the named feature.
77 remoting.ClientPlugin.prototype.hasFeature = function(feature) {};
80 * @return {HTMLEmbedElement} HTML element that corresponds to the plugin.
82 remoting.ClientPlugin.prototype.element = function() {};
87 remoting.ClientPlugin.prototype.cleanup = function() {};
90 * Must be called for each incoming stanza received from the host.
91 * @param {string} iq Incoming IQ stanza.
93 remoting.ClientPlugin.prototype.onIncomingIq = function(iq) {};
96 * @param {string} hostJid The jid of the host to connect to.
97 * @param {string} hostPublicKey The base64 encoded version of the host's
99 * @param {string} localJid Local jid.
100 * @param {string} sharedSecret The access code for IT2Me or the PIN
102 * @param {string} authenticationMethods Comma-separated list of
103 * authentication methods the client should attempt to use.
104 * @param {string} authenticationTag A host-specific tag to mix into
105 * authentication hashes.
106 * @param {string} clientPairingId For paired Me2Me connections, the
107 * pairing id for this client, as issued by the host.
108 * @param {string} clientPairedSecret For paired Me2Me connections, the
109 * paired secret for this client, as issued by the host.
111 remoting.ClientPlugin.prototype.connect = function(
112 hostJid, hostPublicKey, localJid, sharedSecret,
113 authenticationMethods, authenticationTag,
114 clientPairingId, clientPairedSecret) {};
117 * Release all currently pressed keys.
119 remoting.ClientPlugin.prototype.releaseAllKeys = function() {};
122 * Send a key event to the host.
124 * @param {number} usbKeycode The USB-style code of the key to inject.
125 * @param {boolean} pressed True to inject a key press, False for a release.
127 remoting.ClientPlugin.prototype.injectKeyEvent =
128 function(usbKeycode, pressed) {};
131 * Remap one USB keycode to another in all subsequent key events.
133 * @param {number} fromKeycode The USB-style code of the key to remap.
134 * @param {number} toKeycode The USB-style code to remap the key to.
136 remoting.ClientPlugin.prototype.remapKey =
137 function(fromKeycode, toKeycode) {};
140 * Enable/disable redirection of the specified key to the web-app.
142 * @param {number} keycode The USB-style code of the key.
143 * @param {Boolean} trap True to enable trapping, False to disable.
145 remoting.ClientPlugin.prototype.trapKey = function(keycode, trap) {};
148 * Returns an associative array with a set of stats for this connection.
150 * @return {remoting.ClientSession.PerfStats} The connection statistics.
152 remoting.ClientPlugin.prototype.getPerfStats = function() {};
155 * Sends a clipboard item to the host.
157 * @param {string} mimeType The MIME type of the clipboard item.
158 * @param {string} item The clipboard item.
160 remoting.ClientPlugin.prototype.sendClipboardItem = function(mimeType, item) {};
163 * Notifies the host that the client has the specified size and pixel density.
165 * @param {number} width The available client width in DIPs.
166 * @param {number} height The available client height in DIPs.
167 * @param {number} device_scale The number of device pixels per DIP.
169 remoting.ClientPlugin.prototype.notifyClientResolution =
170 function(width, height, device_scale) {};
173 * Requests that the host pause or resume sending video updates.
175 * @param {boolean} pause True to suspend video updates, false otherwise.
177 remoting.ClientPlugin.prototype.pauseVideo =
181 * Requests that the host pause or resume sending audio updates.
183 * @param {boolean} pause True to suspend audio updates, false otherwise.
185 remoting.ClientPlugin.prototype.pauseAudio =
189 * Gives the client authenticator the PIN.
191 * @param {string} pin The PIN.
193 remoting.ClientPlugin.prototype.onPinFetched = function(pin) {};
196 * Tells the plugin to ask for the PIN asynchronously.
198 remoting.ClientPlugin.prototype.useAsyncPinDialog = function() {};
201 * Sets the third party authentication token and shared secret.
203 * @param {string} token The token received from the token URL.
204 * @param {string} sharedSecret Shared secret received from the token URL.
206 remoting.ClientPlugin.prototype.onThirdPartyTokenFetched =
207 function(token, sharedSecret) {};
210 * Request pairing with the host for PIN-less authentication.
212 * @param {string} clientName The human-readable name of the client.
213 * @param {function(string, string):void} onDone, Callback to receive the
214 * client id and shared secret when they are available.
216 remoting.ClientPlugin.prototype.requestPairing = function(
217 clientName, onDone) {};