Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Unified Diff: remoting/webapp/client_plugin_interface.js

Issue 552403004: Interfaceify ClientPlugin in preparation for mocking it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Interfaceify more classes. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/webapp/client_plugin_interface.js
diff --git a/remoting/webapp/client_plugin_interface.js b/remoting/webapp/client_plugin_interface.js
new file mode 100644
index 0000000000000000000000000000000000000000..8a1c66d8b24b2924457d918b3d65e01ac5014256
--- /dev/null
+++ b/remoting/webapp/client_plugin_interface.js
@@ -0,0 +1,282 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
Sergey Ulanov 2014/09/16 02:02:51 year remove (c)
Jamie 2014/09/16 16:23:20 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview
+ * Interface abstracting the ClientPlugin functionality.
+ */
+
+'use strict';
+
+/** @suppress {duplicate} */
+var remoting = remoting || {};
+
+/**
+ * @interface
+ * @extends {base.Disposable}
+ */
+remoting.ClientPluginInterface = function() {};
Sergey Ulanov 2014/09/16 02:02:51 IMO it would be better to call abstract interface
Jamie 2014/09/16 16:23:21 I agree. The problem is that we're expecting a mer
+
+/**
+ * @return {number} The width of the remote desktop, in pixels.
+ */
+remoting.ClientPluginInterface.prototype.getDesktopWidth = function() {};
+
+/**
+ * @return {number} The height of the remote desktop, in pixels.
+ */
+remoting.ClientPluginInterface.prototype.getDesktopHeight = function() {};
+
+/**
+ * @return {number} The x-DPI of the remote desktop.
+ */
+remoting.ClientPluginInterface.prototype.getDesktopXDpi = function() {};
+
+/**
+ * @return {number} The y-DPI of the remote desktop.
+ */
+remoting.ClientPluginInterface.prototype.getDesktopYDpi = function() {};
+
+/**
+ * @return {HTMLElement} The DOM element representing the remote session.
+ */
+remoting.ClientPluginInterface.prototype.element = function() {};
+
+/**
+ * @param {function():void} onDone Completion callback.
+ */
+remoting.ClientPluginInterface.prototype.initialize = function(onDone) {};
+
+/**
+ * @param {string} hostJid The jid of the host to connect to.
+ * @param {string} hostPublicKey The base64 encoded version of the host's
+ * public key.
+ * @param {string} localJid Local jid.
+ * @param {string} sharedSecret The access code for IT2Me or the PIN
+ * for Me2Me.
+ * @param {string} authenticationMethods Comma-separated list of
+ * authentication methods the client should attempt to use.
+ * @param {string} authenticationTag A host-specific tag to mix into
+ * authentication hashes.
+ * @param {string} clientPairingId For paired Me2Me connections, the
+ * pairing id for this client, as issued by the host.
+ * @param {string} clientPairedSecret For paired Me2Me connections, the
+ * paired secret for this client, as issued by the host.
+ */
+remoting.ClientPluginInterface.prototype.connect = function(
+ hostJid, hostPublicKey, localJid, sharedSecret,
+ authenticationMethods, authenticationTag,
+ clientPairingId, clientPairedSecret) {};
+
+/**
+ * @param {number} key The keycode to inject.
+ * @param {boolean} down True for press; false for a release.
+ */
+remoting.ClientPluginInterface.prototype.injectKeyEvent =
+ function(key, down) {};
+
+/**
+ * @param {number} from
+ * @param {number} to
+ */
+remoting.ClientPluginInterface.prototype.remapKey = function(from, to) {};
+
+/**
+ * Release all keys currently being pressed.
+ */
+remoting.ClientPluginInterface.prototype.releaseAllKeys = function() {};
+
+/**
+ * @param {number} width
+ * @param {number} height
+ * @param {number} dpi
+ */
+remoting.ClientPluginInterface.prototype.notifyClientResolution =
+ function(width, height, dpi) {};
+
+/**
+ * @param {string} iq
+ */
+remoting.ClientPluginInterface.prototype.onIncomingIq = function(iq) {};
+
+/**
+ * @return {boolean} True if the web-app and plugin are compatible.
+ */
+remoting.ClientPluginInterface.prototype.isSupportedVersion = function() {};
+
+/**
+ * @param {remoting.ClientPlugin.Feature} feature
+ * @return {boolean} True if the plugin support the specified feature.
+ */
+remoting.ClientPluginInterface.prototype.hasFeature = function(feature) {};
+
+/**
+ * Enable MediaSource rendering via the specified renderer.
+ *
+ * @param {remoting.MediaSourceRenderer} mediaSourceRenderer
+ */
+remoting.ClientPluginInterface.prototype.enableMediaSourceRendering =
+ function(mediaSourceRenderer) {};
+
+/**
+ * Sends a clipboard item to the host.
+ *
+ * @param {string} mimeType The MIME type of the clipboard item.
+ * @param {string} item The clipboard item.
+ */
+remoting.ClientPluginInterface.prototype.sendClipboardItem =
+ function(mimeType, item) {};
+
+/**
+ * Tell the plugin to request a PIN asynchronously.
+ */
+remoting.ClientPluginInterface.prototype.useAsyncPinDialog = function() {};
+
+/**
+ * Request that this client be paired with the current host.
+ *
+ * @param {string} clientName The human-readable name of the client.
+ * @param {function(string, string):void} onDone Callback to receive the
+ * client id and shared secret when they are available.
+ */
+remoting.ClientPluginInterface.prototype.requestPairing =
+ function(clientName, onDone) {};
+
+/**
+ * Called when a PIN is obtained from the user.
+ *
+ * @param {string} pin The PIN.
+ */
+remoting.ClientPluginInterface.prototype.onPinFetched = function(pin) {};
+
+/**
+ * Sets the third party authentication token and shared secret.
+ *
+ * @param {string} token The token received from the token URL.
+ * @param {string} sharedSecret Shared secret received from the token URL.
+ */
+remoting.ClientPluginInterface.prototype.onThirdPartyTokenFetched =
+ function(token, sharedSecret) {};
+
+/**
+ * @param {boolean} pause True to pause the audio stream; false to resume it.
+ */
+remoting.ClientPluginInterface.prototype.pauseAudio = function(pause) {};
+
+/**
+ * @param {boolean} pause True to pause the video stream; false to resume it.
+ */
+remoting.ClientPluginInterface.prototype.pauseVideo = function(pause) {};
+
+/**
+ * @return {remoting.ClientSession.PerfStats} A summary of the connection
+ * performance.
+ */
+remoting.ClientPluginInterface.prototype.getPerfStats = function() {};
+
+/**
+ * Send an extension message to the host.
+ *
+ * @param {string} name
+ * @param {string} data
+ */
+remoting.ClientPluginInterface.prototype.sendClientMessage =
+ function(name, data) {};
+
+/**
+ * @param {function(string):void} handler Callback for sending an IQ stanza.
+ */
+remoting.ClientPluginInterface.prototype.setOnOutgoingIqHandler =
+ function(handler) {};
+
+/**
+ * @param {function(string):void} handler Callback for logging debug messages.
+ */
+remoting.ClientPluginInterface.prototype.setOnDebugMessageHandler =
+ function(handler) {};
+
+/**
+ * @param {function(number, number):void} handler Callback for connection status
+ * update notifications. The first parameter is the connection state; the
+ * second is the error code, if any.
+ */
+remoting.ClientPluginInterface.prototype.setConnectionStatusUpdateHandler =
+ function(handler) {};
+
+/**
+ * @param {function(boolean):void} handler Callback for connection readiness
+ * notifications.
+ */
+remoting.ClientPluginInterface.prototype.setConnectionReadyHandler =
+ function(handler) {};
+
+/**
+ * @param {function():void} handler Callback for desktop size change
+ * notifications.
+ */
+remoting.ClientPluginInterface.prototype.setDesktopSizeUpdateHandler =
+ function(handler) {};
+
+/**
+ * @param {function(!Array.<string>):void} handler Callback to inform of
+ * capabilities negotiated between host and client.
+ */
+remoting.ClientPluginInterface.prototype.setCapabilitiesHandler =
+ function(handler) {};
+
+/**
+ * @param {function(string):void} handler Callback for processing security key
+ * (Gnubby) protocol messages.
+ */
+remoting.ClientPluginInterface.prototype.setGnubbyAuthHandler =
+ function(handler) {};
+
+/**
+ * @param {function(string):void} handler Callback for processing Cast protocol
+ * messages.
+ */
+remoting.ClientPluginInterface.prototype.setCastExtensionHandler =
+ function(handler) {};
+
+/**
+ * @param {function(string, number, number):void} handler Callback for
+ * processing large mouse cursor images. The first parameter is a data:
+ * URL encoding the mouse cursor; the second and third parameters are
+ * the cursor hotspot's x- and y-coordinates, respectively.
+ */
+remoting.ClientPluginInterface.prototype.setMouseCursorHandler =
+ function(handler) {};
+
+/**
+ * @param {function(string, string, string):void} handler Callback for
+ * fetching third-party tokens. The first parameter is the token URL; the
+ * second is the public key of the host; the third is the OAuth2 scope
+ * being requested.
+ */
+remoting.ClientPluginInterface.prototype.setFetchThirdPartyTokenHandler =
+ function(handler) {};
+
+/**
+ * @param {function(boolean):void} handler Callback for fetching a PIN from
+ * the user. The parameter is true if PIN pairing is supported by the
+ * host, or false otherwise.
+ */
+remoting.ClientPluginInterface.prototype.setFetchPinHandler =
+ function(handler) {};
+
+
+/**
+ * @interface
+ */
+remoting.ClientPluginFactory = function() {};
+
+/**
+ * @param {Element} container The container for the embed element.
+ * @param {function(string, string):boolean} onExtensionMessage The handler for
+ * protocol extension messages. Returns true if a message is recognized;
+ * false otherwise.
+ * @return {remoting.ClientPluginInterface} A new client plugin instance.
+ */
+remoting.ClientPluginFactory.prototype.createPlugin =
+ function(container, onExtensionMessage) {};

Powered by Google App Engine
This is Rietveld 408576698