Revert of Enabling audio quality test on mac. (patchset #1 id:1 of https://codereview...
[chromium-blink-merge.git] / remoting / webapp / client_plugin.js
blob106fc78d82c84f89831786978af3443d8cd48067
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.
5 /**
6 * @fileoverview
7 * Interface abstracting the ClientPlugin functionality.
8 */
10 'use strict';
12 /** @suppress {duplicate} */
13 var remoting = remoting || {};
15 /**
16 * @interface
17 * @extends {base.Disposable}
19 remoting.ClientPlugin = function() {};
21 /**
22 * @return {number} The width of the remote desktop, in pixels.
24 remoting.ClientPlugin.prototype.getDesktopWidth = function() {};
26 /**
27 * @return {number} The height of the remote desktop, in pixels.
29 remoting.ClientPlugin.prototype.getDesktopHeight = function() {};
31 /**
32 * @return {number} The x-DPI of the remote desktop.
34 remoting.ClientPlugin.prototype.getDesktopXDpi = function() {};
36 /**
37 * @return {number} The y-DPI of the remote desktop.
39 remoting.ClientPlugin.prototype.getDesktopYDpi = function() {};
41 /**
42 * @return {HTMLElement} The DOM element representing the remote session.
44 remoting.ClientPlugin.prototype.element = function() {};
46 /**
47 * @param {function():void} onDone Completion callback.
49 remoting.ClientPlugin.prototype.initialize = function(onDone) {};
51 /**
52 * @param {string} hostJid The jid of the host to connect to.
53 * @param {string} hostPublicKey The base64 encoded version of the host's
54 * public key.
55 * @param {string} localJid Local jid.
56 * @param {string} sharedSecret The access code for IT2Me or the PIN
57 * for Me2Me.
58 * @param {string} authenticationMethods Comma-separated list of
59 * authentication methods the client should attempt to use.
60 * @param {string} authenticationTag A host-specific tag to mix into
61 * authentication hashes.
62 * @param {string} clientPairingId For paired Me2Me connections, the
63 * pairing id for this client, as issued by the host.
64 * @param {string} clientPairedSecret For paired Me2Me connections, the
65 * paired secret for this client, as issued by the host.
67 remoting.ClientPlugin.prototype.connect = function(
68 hostJid, hostPublicKey, localJid, sharedSecret,
69 authenticationMethods, authenticationTag,
70 clientPairingId, clientPairedSecret) {};
72 /**
73 * @param {number} key The keycode to inject.
74 * @param {boolean} down True for press; false for a release.
76 remoting.ClientPlugin.prototype.injectKeyEvent =
77 function(key, down) {};
79 /**
80 * @param {number} from
81 * @param {number} to
83 remoting.ClientPlugin.prototype.remapKey = function(from, to) {};
85 /**
86 * Release all keys currently being pressed.
88 remoting.ClientPlugin.prototype.releaseAllKeys = function() {};
90 /**
91 * @param {number} width
92 * @param {number} height
93 * @param {number} dpi
95 remoting.ClientPlugin.prototype.notifyClientResolution =
96 function(width, height, dpi) {};
98 /**
99 * @param {string} iq
101 remoting.ClientPlugin.prototype.onIncomingIq = function(iq) {};
104 * @return {boolean} True if the web-app and plugin are compatible.
106 remoting.ClientPlugin.prototype.isSupportedVersion = function() {};
109 * @param {remoting.ClientPlugin.Feature} feature
110 * @return {boolean} True if the plugin support the specified feature.
112 remoting.ClientPlugin.prototype.hasFeature = function(feature) {};
115 * Enable MediaSource rendering via the specified renderer.
117 * @param {remoting.MediaSourceRenderer} mediaSourceRenderer
119 remoting.ClientPlugin.prototype.enableMediaSourceRendering =
120 function(mediaSourceRenderer) {};
123 * Sends a clipboard item to the host.
125 * @param {string} mimeType The MIME type of the clipboard item.
126 * @param {string} item The clipboard item.
128 remoting.ClientPlugin.prototype.sendClipboardItem =
129 function(mimeType, item) {};
132 * Tell the plugin to request a PIN asynchronously.
134 remoting.ClientPlugin.prototype.useAsyncPinDialog = function() {};
137 * Request that this client be paired with the current host.
139 * @param {string} clientName The human-readable name of the client.
140 * @param {function(string, string):void} onDone Callback to receive the
141 * client id and shared secret when they are available.
143 remoting.ClientPlugin.prototype.requestPairing =
144 function(clientName, onDone) {};
147 * Called when a PIN is obtained from the user.
149 * @param {string} pin The PIN.
151 remoting.ClientPlugin.prototype.onPinFetched = function(pin) {};
154 * Sets the third party authentication token and shared secret.
156 * @param {string} token The token received from the token URL.
157 * @param {string} sharedSecret Shared secret received from the token URL.
159 remoting.ClientPlugin.prototype.onThirdPartyTokenFetched =
160 function(token, sharedSecret) {};
163 * @param {boolean} pause True to pause the audio stream; false to resume it.
165 remoting.ClientPlugin.prototype.pauseAudio = function(pause) {};
168 * @param {boolean} pause True to pause the video stream; false to resume it.
170 remoting.ClientPlugin.prototype.pauseVideo = function(pause) {};
173 * @return {remoting.ClientSession.PerfStats} A summary of the connection
174 * performance.
176 remoting.ClientPlugin.prototype.getPerfStats = function() {};
179 * Send an extension message to the host.
181 * @param {string} name
182 * @param {string} data
184 remoting.ClientPlugin.prototype.sendClientMessage =
185 function(name, data) {};
188 * @param {function(string):void} handler Callback for sending an IQ stanza.
190 remoting.ClientPlugin.prototype.setOnOutgoingIqHandler =
191 function(handler) {};
194 * @param {function(string):void} handler Callback for logging debug messages.
196 remoting.ClientPlugin.prototype.setOnDebugMessageHandler =
197 function(handler) {};
200 * @param {function(number, number):void} handler Callback for connection status
201 * update notifications. The first parameter is the connection state; the
202 * second is the error code, if any.
204 remoting.ClientPlugin.prototype.setConnectionStatusUpdateHandler =
205 function(handler) {};
208 * @param {function(boolean):void} handler Callback for connection readiness
209 * notifications.
211 remoting.ClientPlugin.prototype.setConnectionReadyHandler =
212 function(handler) {};
215 * @param {function():void} handler Callback for desktop size change
216 * notifications.
218 remoting.ClientPlugin.prototype.setDesktopSizeUpdateHandler =
219 function(handler) {};
222 * @param {function(!Array.<string>):void} handler Callback to inform of
223 * capabilities negotiated between host and client.
225 remoting.ClientPlugin.prototype.setCapabilitiesHandler =
226 function(handler) {};
229 * @param {function(string):void} handler Callback for processing security key
230 * (Gnubby) protocol messages.
232 remoting.ClientPlugin.prototype.setGnubbyAuthHandler =
233 function(handler) {};
236 * @param {function(string):void} handler Callback for processing Cast protocol
237 * messages.
239 remoting.ClientPlugin.prototype.setCastExtensionHandler =
240 function(handler) {};
243 * @param {function(string, number, number):void} handler Callback for
244 * processing large mouse cursor images. The first parameter is a data:
245 * URL encoding the mouse cursor; the second and third parameters are
246 * the cursor hotspot's x- and y-coordinates, respectively.
248 remoting.ClientPlugin.prototype.setMouseCursorHandler =
249 function(handler) {};
252 * @param {function(string, string, string):void} handler Callback for
253 * fetching third-party tokens. The first parameter is the token URL; the
254 * second is the public key of the host; the third is the OAuth2 scope
255 * being requested.
257 remoting.ClientPlugin.prototype.setFetchThirdPartyTokenHandler =
258 function(handler) {};
261 * @param {function(boolean):void} handler Callback for fetching a PIN from
262 * the user. The parameter is true if PIN pairing is supported by the
263 * host, or false otherwise.
265 remoting.ClientPlugin.prototype.setFetchPinHandler =
266 function(handler) {};
270 * Set of features for which hasFeature() can be used to test.
272 * @enum {string}
274 remoting.ClientPlugin.Feature = {
275 INJECT_KEY_EVENT: 'injectKeyEvent',
276 NOTIFY_CLIENT_RESOLUTION: 'notifyClientResolution',
277 ASYNC_PIN: 'asyncPin',
278 PAUSE_VIDEO: 'pauseVideo',
279 PAUSE_AUDIO: 'pauseAudio',
280 REMAP_KEY: 'remapKey',
281 SEND_CLIPBOARD_ITEM: 'sendClipboardItem',
282 THIRD_PARTY_AUTH: 'thirdPartyAuth',
283 TRAP_KEY: 'trapKey',
284 PINLESS_AUTH: 'pinlessAuth',
285 EXTENSION_MESSAGE: 'extensionMessage',
286 MEDIA_SOURCE_RENDERING: 'mediaSourceRendering',
287 VIDEO_CONTROL: 'videoControl'
292 * @interface
294 remoting.ClientPluginFactory = function() {};
297 * @param {Element} container The container for the embed element.
298 * @param {function(string, string):boolean} onExtensionMessage The handler for
299 * protocol extension messages. Returns true if a message is recognized;
300 * false otherwise.
301 * @return {remoting.ClientPlugin} A new client plugin instance.
303 remoting.ClientPluginFactory.prototype.createPlugin =
304 function(container, onExtensionMessage) {};
307 * Preload the plugin to make instantiation faster when the user tries
308 * to connect.
310 remoting.ClientPluginFactory.prototype.preloadPlugin = function() {};
313 * @type {remoting.ClientPluginFactory}
315 remoting.ClientPlugin.factory = null;