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_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',
     68   TRAP_KEY: 'trapKey',
     69   PINLESS_AUTH: 'pinlessAuth',
     70   EXTENSION_MESSAGE: 'extensionMessage'
     71 };
     72 
     73 /**
     74  * @param {remoting.ClientPlugin.Feature} feature The feature to test for.
     75  * @return {boolean} True if the plugin supports the named feature.
     76  */
     77 remoting.ClientPlugin.prototype.hasFeature = function(feature) {};
     78 
     79 /**
     80  * @return {HTMLEmbedElement} HTML element that corresponds to the plugin.
     81  */
     82 remoting.ClientPlugin.prototype.element = function() {};
     83 
     84 /**
     85  * Deletes the plugin.
     86  */
     87 remoting.ClientPlugin.prototype.cleanup = function() {};
     88 
     89 /**
     90  * Must be called for each incoming stanza received from the host.
     91  * @param {string} iq Incoming IQ stanza.
     92  */
     93 remoting.ClientPlugin.prototype.onIncomingIq = function(iq) {};
     94 
     95 /**
     96  * @param {string} hostJid The jid of the host to connect to.
     97  * @param {string} hostPublicKey The base64 encoded version of the host's
     98  *     public key.
     99  * @param {string} localJid Local jid.
    100  * @param {string} sharedSecret The access code for IT2Me or the PIN
    101  *     for Me2Me.
    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.
    110  */
    111 remoting.ClientPlugin.prototype.connect = function(
    112     hostJid, hostPublicKey, localJid, sharedSecret,
    113     authenticationMethods, authenticationTag,
    114     clientPairingId, clientPairedSecret) {};
    115 
    116 /**
    117  * Release all currently pressed keys.
    118  */
    119 remoting.ClientPlugin.prototype.releaseAllKeys = function() {};
    120 
    121 /**
    122  * Send a key event to the host.
    123  *
    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.
    126  */
    127 remoting.ClientPlugin.prototype.injectKeyEvent =
    128     function(usbKeycode, pressed) {};
    129 
    130 /**
    131  * Remap one USB keycode to another in all subsequent key events.
    132  *
    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.
    135  */
    136 remoting.ClientPlugin.prototype.remapKey =
    137     function(fromKeycode, toKeycode) {};
    138 
    139 /**
    140  * Enable/disable redirection of the specified key to the web-app.
    141  *
    142  * @param {number} keycode The USB-style code of the key.
    143  * @param {Boolean} trap True to enable trapping, False to disable.
    144  */
    145 remoting.ClientPlugin.prototype.trapKey = function(keycode, trap) {};
    146 
    147 /**
    148  * Returns an associative array with a set of stats for this connection.
    149  *
    150  * @return {remoting.ClientSession.PerfStats} The connection statistics.
    151  */
    152 remoting.ClientPlugin.prototype.getPerfStats = function() {};
    153 
    154 /**
    155  * Sends a clipboard item to the host.
    156  *
    157  * @param {string} mimeType The MIME type of the clipboard item.
    158  * @param {string} item The clipboard item.
    159  */
    160 remoting.ClientPlugin.prototype.sendClipboardItem = function(mimeType, item) {};
    161 
    162 /**
    163  * Notifies the host that the client has the specified size and pixel density.
    164  *
    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.
    168  */
    169 remoting.ClientPlugin.prototype.notifyClientResolution =
    170     function(width, height, device_scale) {};
    171 
    172 /**
    173  * Requests that the host pause or resume sending video updates.
    174  *
    175  * @param {boolean} pause True to suspend video updates, false otherwise.
    176  */
    177 remoting.ClientPlugin.prototype.pauseVideo =
    178     function(pause) {};
    179 
    180 /**
    181  * Requests that the host pause or resume sending audio updates.
    182  *
    183  * @param {boolean} pause True to suspend audio updates, false otherwise.
    184  */
    185 remoting.ClientPlugin.prototype.pauseAudio =
    186     function(pause) {};
    187 
    188 /**
    189  * Gives the client authenticator the PIN.
    190  *
    191  * @param {string} pin The PIN.
    192  */
    193 remoting.ClientPlugin.prototype.onPinFetched = function(pin) {};
    194 
    195 /**
    196  * Tells the plugin to ask for the PIN asynchronously.
    197  */
    198 remoting.ClientPlugin.prototype.useAsyncPinDialog = function() {};
    199 
    200 /**
    201  * Sets the third party authentication token and shared secret.
    202  *
    203  * @param {string} token The token received from the token URL.
    204  * @param {string} sharedSecret Shared secret received from the token URL.
    205  */
    206 remoting.ClientPlugin.prototype.onThirdPartyTokenFetched =
    207     function(token, sharedSecret) {};
    208 
    209 /**
    210  * Request pairing with the host for PIN-less authentication.
    211  *
    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.
    215  */
    216 remoting.ClientPlugin.prototype.requestPairing = function(
    217     clientName, onDone) {};
    218