Home | History | Annotate | Download | only in webapp
      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.
      4 
      5 /** @suppress {duplicate} */
      6 var remoting = remoting || {};
      7 
      8 /**
      9  * Interface used for ClientPlugin objects.
     10  * @interface
     11  */
     12 remoting.ClientPlugin = function() {
     13 };
     14 
     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;
     23 
     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;
     38 
     39 /**
     40  * Initializes the plugin asynchronously and calls specified function
     41  * when done.
     42  *
     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.
     46  */
     47 remoting.ClientPlugin.prototype.initialize = function(onDone) {};
     48 
     49 /**
     50  * @return {boolean} True if the plugin and web-app versions are compatible.
     51  */
     52 remoting.ClientPlugin.prototype.isSupportedVersion = function() {};
     53 
     54 /**
     55  * Set of features for which hasFeature() can be used to test.
     56  *
     57  * @enum {string}
     58  */
     59 remoting.ClientPlugin.Feature = {
     60   INJECT_KEY_EVENT: 'injectKeyEvent',
     61   NOTIFY_CLIENT_DIMENSIONS: 'notifyClientDimensions',
     62   NOTIFY_CLIENT_RESOLUTION: 'notifyClientResolution',
     63   ASYNC_PIN: 'asyncPin',
     64   PAUSE_VIDEO: 'pauseVideo',
     65   PAUSE_AUDIO: 'pauseAudio',
     66   REMAP_KEY: 'remapKey',
     67   SEND_CLIPBOARD_ITEM: 'sendClipboardItem',
     68   THIRD_PARTY_AUTH: 'thirdPartyAuth',
     69   TRAP_KEY: 'trapKey',
     70   PINLESS_AUTH: 'pinlessAuth',
     71   EXTENSION_MESSAGE: 'extensionMessage'
     72 };
     73 
     74 /**
     75  * @param {remoting.ClientPlugin.Feature} feature The feature to test for.
     76  * @return {boolean} True if the plugin supports the named feature.
     77  */
     78 remoting.ClientPlugin.prototype.hasFeature = function(feature) {};
     79 
     80 /**
     81  * @return {HTMLEmbedElement} HTML element that corresponds to the plugin.
     82  */
     83 remoting.ClientPlugin.prototype.element = function() {};
     84 
     85 /**
     86  * Deletes the plugin.
     87  */
     88 remoting.ClientPlugin.prototype.cleanup = function() {};
     89 
     90 /**
     91  * Must be called for each incoming stanza received from the host.
     92  * @param {string} iq Incoming IQ stanza.
     93  */
     94 remoting.ClientPlugin.prototype.onIncomingIq = function(iq) {};
     95 
     96 /**
     97  * @param {string} hostJid The jid of the host to connect to.
     98  * @param {string} hostPublicKey The base64 encoded version of the host's
     99  *     public key.
    100  * @param {string} localJid Local jid.
    101  * @param {string} sharedSecret The access code for IT2Me or the PIN
    102  *     for Me2Me.
    103  * @param {string} authenticationMethods Comma-separated list of
    104  *     authentication methods the client should attempt to use.
    105  * @param {string} authenticationTag A host-specific tag to mix into
    106  *     authentication hashes.
    107  * @param {string} clientPairingId For paired Me2Me connections, the
    108  *     pairing id for this client, as issued by the host.
    109  * @param {string} clientPairedSecret For paired Me2Me connections, the
    110  *     paired secret for this client, as issued by the host.
    111  */
    112 remoting.ClientPlugin.prototype.connect = function(
    113     hostJid, hostPublicKey, localJid, sharedSecret,
    114     authenticationMethods, authenticationTag,
    115     clientPairingId, clientPairedSecret) {};
    116 
    117 /**
    118  * Release all currently pressed keys.
    119  */
    120 remoting.ClientPlugin.prototype.releaseAllKeys = function() {};
    121 
    122 /**
    123  * Send a key event to the host.
    124  *
    125  * @param {number} usbKeycode The USB-style code of the key to inject.
    126  * @param {boolean} pressed True to inject a key press, False for a release.
    127  */
    128 remoting.ClientPlugin.prototype.injectKeyEvent =
    129     function(usbKeycode, pressed) {};
    130 
    131 /**
    132  * Remap one USB keycode to another in all subsequent key events.
    133  *
    134  * @param {number} fromKeycode The USB-style code of the key to remap.
    135  * @param {number} toKeycode The USB-style code to remap the key to.
    136  */
    137 remoting.ClientPlugin.prototype.remapKey =
    138     function(fromKeycode, toKeycode) {};
    139 
    140 /**
    141  * Enable/disable redirection of the specified key to the web-app.
    142  *
    143  * @param {number} keycode The USB-style code of the key.
    144  * @param {Boolean} trap True to enable trapping, False to disable.
    145  */
    146 remoting.ClientPlugin.prototype.trapKey = function(keycode, trap) {};
    147 
    148 /**
    149  * Returns an associative array with a set of stats for this connection.
    150  *
    151  * @return {remoting.ClientSession.PerfStats} The connection statistics.
    152  */
    153 remoting.ClientPlugin.prototype.getPerfStats = function() {};
    154 
    155 /**
    156  * Sends a clipboard item to the host.
    157  *
    158  * @param {string} mimeType The MIME type of the clipboard item.
    159  * @param {string} item The clipboard item.
    160  */
    161 remoting.ClientPlugin.prototype.sendClipboardItem = function(mimeType, item) {};
    162 
    163 /**
    164  * Notifies the host that the client has the specified size and pixel density.
    165  *
    166  * @param {number} width The available client width in DIPs.
    167  * @param {number} height The available client height in DIPs.
    168  * @param {number} device_scale The number of device pixels per DIP.
    169  */
    170 remoting.ClientPlugin.prototype.notifyClientResolution =
    171     function(width, height, device_scale) {};
    172 
    173 /**
    174  * Requests that the host pause or resume sending video updates.
    175  *
    176  * @param {boolean} pause True to suspend video updates, false otherwise.
    177  */
    178 remoting.ClientPlugin.prototype.pauseVideo =
    179     function(pause) {};
    180 
    181 /**
    182  * Requests that the host pause or resume sending audio updates.
    183  *
    184  * @param {boolean} pause True to suspend audio updates, false otherwise.
    185  */
    186 remoting.ClientPlugin.prototype.pauseAudio =
    187     function(pause) {};
    188 
    189 /**
    190  * Gives the client authenticator the PIN.
    191  *
    192  * @param {string} pin The PIN.
    193  */
    194 remoting.ClientPlugin.prototype.onPinFetched = function(pin) {};
    195 
    196 /**
    197  * Tells the plugin to ask for the PIN asynchronously.
    198  */
    199 remoting.ClientPlugin.prototype.useAsyncPinDialog = function() {};
    200 
    201 /**
    202  * Sets the third party authentication token and shared secret.
    203  *
    204  * @param {string} token The token received from the token URL.
    205  * @param {string} sharedSecret Shared secret received from the token URL.
    206  */
    207 remoting.ClientPlugin.prototype.onThirdPartyTokenFetched =
    208     function(token, sharedSecret) {};
    209 
    210 /**
    211  * Request pairing with the host for PIN-less authentication.
    212  *
    213  * @param {string} clientName The human-readable name of the client.
    214  * @param {function(string, string):void} onDone, Callback to receive the
    215  *     client id and shared secret when they are available.
    216  */
    217 remoting.ClientPlugin.prototype.requestPairing = function(
    218     clientName, onDone) {};
    219