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 {remoting.ProtocolExtensionManager}
29 remoting.ClientPlugin.prototype.extensions = function() {};
32 * @return {HTMLElement} The DOM element representing the remote session.
34 remoting.ClientPlugin.prototype.element = function() {};
37 * @param {function(boolean):void} onDone Completion callback.
39 remoting.ClientPlugin.prototype.initialize = function(onDone) {};
42 * @param {remoting.Host} host The host to connect to.
43 * @param {string} localJid Local jid.
44 * @param {remoting.CredentialsProvider} credentialsProvider
46 remoting.ClientPlugin.prototype.connect =
47 function(host, localJid, credentialsProvider) {};
50 * @param {number} key The keycode to inject.
51 * @param {boolean} down True for press; false for a release.
53 remoting.ClientPlugin.prototype.injectKeyEvent =
54 function(key, down) {};
57 * Sends a key combination to the host, by sending down events for
58 * the given keys, followed by up events in reverse order.
60 * @param {Array<number>} keys Key codes to be sent.
61 * @return {void} Nothing.
63 remoting.ClientPlugin.prototype.injectKeyCombination = function(keys) {};
66 * Sets and stores the key remapping setting for the current host.
68 * @param {!Object} remappings Key mappings, specified as {from: to}, where
69 * |from| and |to| are both USB keycodes, |from| is a decimal representation
70 * (because object keys must be strings) and |to| is a number.
72 remoting.ClientPlugin.prototype.setRemapKeys = function(remappings) {};
75 * @param {number} from
78 remoting.ClientPlugin.prototype.remapKey = function(from, to) {};
81 * Release all keys currently being pressed.
83 remoting.ClientPlugin.prototype.releaseAllKeys = function() {};
88 remoting.ClientPlugin.prototype.onIncomingIq = function(iq) {};
91 * @return {boolean} True if the web-app and plugin are compatible.
93 remoting.ClientPlugin.prototype.isSupportedVersion = function() {};
96 * @param {remoting.ClientPlugin.Feature} feature
97 * @return {boolean} True if the plugin supports the specified feature.
99 remoting.ClientPlugin.prototype.hasFeature = function(feature) {};
103 * @param {remoting.ClientSession.Capability} capability
104 * @return {boolean} True if the capability has been negotiated between
105 * the client and host.
107 remoting.ClientPlugin.prototype.hasCapability = function(capability) {};
110 * Sends a clipboard item to the host.
112 * @param {string} mimeType The MIME type of the clipboard item.
113 * @param {string} item The clipboard item.
115 remoting.ClientPlugin.prototype.sendClipboardItem =
116 function(mimeType, item) {};
119 * Notifies the plugin whether to send touch events to the host.
121 * @param {boolean} enable True if touch events should be sent.
123 remoting.ClientPlugin.prototype.enableTouchEvents = function(enable) {};
126 * Request that this client be paired with the current host.
128 * @param {string} clientName The human-readable name of the client.
129 * @param {function(string, string):void} onDone Callback to receive the
130 * client id and shared secret when they are available.
132 remoting.ClientPlugin.prototype.requestPairing =
133 function(clientName, onDone) {};
136 * Allows automatic mouse-lock.
138 remoting.ClientPlugin.prototype.allowMouseLock = function() {};
141 * @param {boolean} pause True to pause the audio stream; false to resume it.
143 remoting.ClientPlugin.prototype.pauseAudio = function(pause) {};
146 * @param {boolean} pause True to pause the video stream; false to resume it.
148 remoting.ClientPlugin.prototype.pauseVideo = function(pause) {};
151 * @return {remoting.ClientSession.PerfStats} A summary of the connection
154 remoting.ClientPlugin.prototype.getPerfStats = function() {};
157 * @param {remoting.ClientPlugin.ConnectionEventHandler} handler
159 remoting.ClientPlugin.prototype.setConnectionEventHandler =
160 function(handler) {};
163 * @param {function(string, number, number):void} handler Callback for
164 * processing large mouse cursor images. The first parameter is a data:
165 * URL encoding the mouse cursor; the second and third parameters are
166 * the cursor hotspot's x- and y-coordinates, respectively.
168 remoting.ClientPlugin.prototype.setMouseCursorHandler = function(handler) {};
171 * @param {function(string, string):void} handler Callback for processing
172 * clipboard data injected from the host. The first parameter is the mime
173 * type and the second parameter is the actual data.
175 remoting.ClientPlugin.prototype.setClipboardHandler = function(handler) {};
178 * @param {function({rects:Array<Array<number>>}):void|null} handler Callback
179 * to receive dirty region information for each video frame, for debugging.
181 remoting.ClientPlugin.prototype.setDebugDirtyRegionHandler =
182 function(handler) {};
186 * Set of features for which hasFeature() can be used to test.
190 remoting.ClientPlugin.Feature = {
191 INJECT_KEY_EVENT: 'injectKeyEvent',
192 NOTIFY_CLIENT_RESOLUTION: 'notifyClientResolution',
193 ASYNC_PIN: 'asyncPin',
194 PAUSE_VIDEO: 'pauseVideo',
195 PAUSE_AUDIO: 'pauseAudio',
196 REMAP_KEY: 'remapKey',
197 SEND_CLIPBOARD_ITEM: 'sendClipboardItem',
198 THIRD_PARTY_AUTH: 'thirdPartyAuth',
200 PINLESS_AUTH: 'pinlessAuth',
201 ALLOW_MOUSE_LOCK: 'allowMouseLock',
202 EXTENSION_MESSAGE: 'extensionMessage',
203 VIDEO_CONTROL: 'videoControl'
210 remoting.ClientPlugin.ConnectionEventHandler = function() {};
215 remoting.ClientPlugin.ConnectionEventHandler.prototype.onOutgoingIq =
219 * @param {string} msg
221 remoting.ClientPlugin.ConnectionEventHandler.prototype.onDebugMessage =
225 * @param {remoting.ClientSession.State} status The plugin's status.
226 * @param {remoting.ClientSession.ConnectionError} error The plugin's error
229 remoting.ClientPlugin.ConnectionEventHandler.prototype.
230 onConnectionStatusUpdate = function(status, error) {};
233 * @param {string} channel The channel name.
234 * @param {string} connectionType The new connection type.
236 remoting.ClientPlugin.ConnectionEventHandler.prototype.onRouteChanged =
237 function(channel, connectionType) {};
240 * @param {boolean} ready True if the connection is ready.
242 remoting.ClientPlugin.ConnectionEventHandler.prototype.onConnectionReady =
245 /** Called when the first video frame is received */
246 remoting.ClientPlugin.ConnectionEventHandler.prototype.onFirstFrameReceived =
252 remoting.ClientPluginFactory = function() {};
255 * @param {Element} container The container for the embed element.
256 * @param {Array<string>} requiredCapabilities
257 * @return {remoting.ClientPlugin} A new client plugin instance.
259 remoting.ClientPluginFactory.prototype.createPlugin =
260 function(container, requiredCapabilities) {};
263 * Preload the plugin to make instantiation faster when the user tries
266 remoting.ClientPluginFactory.prototype.preloadPlugin = function() {};
269 * @type {remoting.ClientPluginFactory}
271 remoting.ClientPlugin.factory = null;