diff options
author | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-31 20:00:59 +0000 |
---|---|---|
committer | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-31 20:00:59 +0000 |
commit | b881dc14a61bba462385d9a90591e7c419523e75 (patch) | |
tree | 69cbfc810063fdff2cd3d7528eaf073e519dbd33 /remoting | |
parent | 357cb9b1ba53e24b8cbb53d187653353a2351cd5 (diff) | |
download | chromium_src-b881dc14a61bba462385d9a90591e7c419523e75.zip chromium_src-b881dc14a61bba462385d9a90591e7c419523e75.tar.gz chromium_src-b881dc14a61bba462385d9a90591e7c419523e75.tar.bz2 |
Remove Chromoting web-app client plugin V1 wrappers
BUG=130335
TEST=Manual verification of web-app client functionality, and PyAuto tests.
Review URL: https://chromiumcodereview.appspot.com/10441105
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139843 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/remoting.gyp | 1 | ||||
-rw-r--r-- | remoting/webapp/client_plugin.js | 6 | ||||
-rw-r--r-- | remoting/webapp/client_plugin_async.js | 10 | ||||
-rw-r--r-- | remoting/webapp/client_plugin_v1.js | 272 | ||||
-rw-r--r-- | remoting/webapp/client_screen.js | 41 | ||||
-rw-r--r-- | remoting/webapp/client_session.js | 10 | ||||
-rw-r--r-- | remoting/webapp/main.html | 1 | ||||
-rw-r--r-- | remoting/webapp/viewer_plugin_proto.js | 61 |
8 files changed, 10 insertions, 392 deletions
diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp index 561531d..93ac020 100644 --- a/remoting/remoting.gyp +++ b/remoting/remoting.gyp @@ -122,7 +122,6 @@ 'resources/icon_warning.png', 'webapp/client_plugin.js', 'webapp/client_plugin_async.js', - 'webapp/client_plugin_v1.js', 'webapp/client_screen.js', 'webapp/client_session.js', 'webapp/clipboard.js', diff --git a/remoting/webapp/client_plugin.js b/remoting/webapp/client_plugin.js index f496f63..9210ab7 100644 --- a/remoting/webapp/client_plugin.js +++ b/remoting/webapp/client_plugin.js @@ -94,12 +94,6 @@ remoting.ClientPlugin.prototype.connect = function( authenticationMethods, authenticationTag) {}; /** - * @param {boolean} scaleToFit True if scale-to-fit should be enabled. - */ -remoting.ClientPlugin.prototype.setScaleToFit = - function(scaleToFit) {}; - -/** * Release all currently pressed keys. */ remoting.ClientPlugin.prototype.releaseAllKeys = function() {}; diff --git a/remoting/webapp/client_plugin_async.js b/remoting/webapp/client_plugin_async.js index 4d128b8..e57902eb 100644 --- a/remoting/webapp/client_plugin_async.js +++ b/remoting/webapp/client_plugin_async.js @@ -294,16 +294,6 @@ remoting.ClientPluginAsync.prototype.connect = function( }; /** - * @param {boolean} scaleToFit True if scale-to-fit should be enabled. - */ -remoting.ClientPluginAsync.prototype.setScaleToFit = function(scaleToFit) { - // scaleToFit() will be removed in future versions of the plugin. - if (this.plugin && typeof this.plugin.setScaleToFit === 'function') - this.plugin.setScaleToFit(scaleToFit); -}; - - -/** * Release all currently pressed keys. */ remoting.ClientPluginAsync.prototype.releaseAllKeys = function() { diff --git a/remoting/webapp/client_plugin_v1.js b/remoting/webapp/client_plugin_v1.js deleted file mode 100644 index 01801e9..0000000 --- a/remoting/webapp/client_plugin_v1.js +++ /dev/null @@ -1,272 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/** - * @fileoverview - * Class that wraps low-level details of interacting with the client plugin. - * - * This abstracts a <embed> element and controls the plugin which does - * the actual remoting work. It also handles differences between - * client plugins versions when it is necessary. - */ - -'use strict'; - -/** @suppress {duplicate} */ -var remoting = remoting || {}; - -/** - * @param {remoting.ViewerPlugin} plugin The plugin embed element. - * @constructor - * @implements {remoting.ClientPlugin} - */ -remoting.ClientPluginV1 = function(plugin) { - this.plugin = plugin; - - this.desktopWidth = 0; - this.desktopHeight = 0; - - /** @param {string} iq The Iq stanza received from the host. */ - this.onOutgoingIqHandler = function (iq) {}; - /** @param {string} message Log message. */ - this.onDebugMessageHandler = function (message) {}; - /** - * @param {number} status The plugin status. - * @param {number} error The plugin error status, if any. - */ - this.onConnectionStatusUpdateHandler = function(status, error) {}; - this.onDesktopSizeUpdateHandler = function () {}; - - // Connect event handlers. - - /** @param {string} iq The IQ stanza to send. */ - this.plugin.sendIq = this.onSendIq_.bind(this); - - /** @param {string} msg The message to log. */ - this.plugin.debugInfo = this.onDebugInfo_.bind(this); - - /** - * @param {number} status The plugin status. - * @param {number} error The plugin error status, if any. - */ - this.plugin.connectionInfoUpdate = this.onConnectionInfoUpdate_.bind(this); - this.plugin.desktopSizeUpdate = this.onDesktopSizeUpdate_.bind(this); -}; - -/** - * Chromoting session API version (for this javascript). - * This is compared with the plugin API version to verify that they are - * compatible. - * - * @const - * @private - */ -remoting.ClientPluginV1.prototype.API_VERSION_ = 4; - -/** - * The oldest API version that we support. - * This will differ from the |API_VERSION_| if we maintain backward - * compatibility with older API versions. - * - * @const - * @private - */ -remoting.ClientPluginV1.prototype.API_MIN_VERSION_ = 2; - -/** @param {string} iq The Iq stanza received from the host. */ -remoting.ClientPluginV1.prototype.onSendIq_ = function(iq) { - this.onOutgoingIqHandler(iq); -} - - /** @param {string} message The IQ stanza to send. */ -remoting.ClientPluginV1.prototype.onDebugInfo_ = function(message) { - this.onDebugMessageHandler(message); -} - -/** - * @param {number} status The plugin status. - * @param {number} error The plugin error status, if any. - */ -remoting.ClientPluginV1.prototype.onConnectionInfoUpdate_= - function(status, error) { - // Old plugins didn't pass the status and error values, so get - // them directly. Note that there is a race condition inherent in - // this approach. - if (typeof(status) == 'undefined') - status = this.plugin.status; - if (typeof(error) == 'undefined') - error = this.plugin.error; - this.onConnectionStatusUpdateHandler(status, error); -}; - -remoting.ClientPluginV1.prototype.onDesktopSizeUpdate_ = function() { - this.desktopWidth = this.plugin.desktopWidth; - this.desktopHeight = this.plugin.desktopHeight; - this.onDesktopSizeUpdateHandler(); -} - -/** - * Deletes the plugin. - */ -remoting.ClientPluginV1.prototype.cleanup = function() { - this.plugin.parentNode.removeChild(this.plugin); -}; - -/** - * @return {HTMLEmbedElement} HTML element that correspods to the plugin. - */ -remoting.ClientPluginV1.prototype.element = function() { - return this.plugin; -}; - -/** - * @param {function(boolean): void} onDone - */ -remoting.ClientPluginV1.prototype.initialize = function(onDone) { - onDone(typeof this.plugin.connect === 'function'); -}; - -/** - * @return {boolean} True if the plugin and web-app versions are compatible. - */ -remoting.ClientPluginV1.prototype.isSupportedVersion = function() { - return this.API_VERSION_ >= this.plugin.apiMinVersion && - this.plugin.apiVersion >= this.API_MIN_VERSION_; -}; - -/** - * @param {remoting.ClientPlugin.Feature} feature The feature to test for. - * @return {boolean} True if the plugin supports the named feature. - */ -remoting.ClientPluginV1.prototype.hasFeature = function(feature) { - if (feature == remoting.ClientPlugin.Feature.HIGH_QUALITY_SCALING) - return this.plugin.apiVersion >= 3; - return false; -}; - -/** - * @return {boolean} True if the plugin supports the injectKeyEvent API. - */ -remoting.ClientPluginV1.prototype.isInjectKeyEventSupported = function() { - return false; -}; - -/** - * @param {string} iq Incoming IQ stanza. - */ -remoting.ClientPluginV1.prototype.onIncomingIq = function(iq) { - if (this.plugin && this.plugin.onIq) { - this.plugin.onIq(iq); - } else { - // plugin.onIq may not be set after the plugin has been shut - // down. Particularly this happens when we receive response to - // session-terminate stanza. - console.warn('plugin.onIq is not set so dropping incoming message.'); - } -}; - -/** - * @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} clientJid 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. - */ -remoting.ClientPluginV1.prototype.connect = function( - hostJid, hostPublicKey, clientJid, sharedSecret, - authenticationMethods, authenticationTag) { - if (this.plugin.apiVersion < 4) { - // Client plugin versions prior to 4 didn't support the last two - // parameters. - this.plugin.connect(hostJid, hostPublicKey, clientJid, sharedSecret); - } else { - this.plugin.connect(hostJid, hostPublicKey, clientJid, sharedSecret, - authenticationMethods, authenticationTag); - } -}; - -/** - * @param {boolean} scaleToFit True if scale-to-fit should be enabled. - */ -remoting.ClientPluginV1.prototype.setScaleToFit = function(scaleToFit) { - // scaleToFit() will be removed in future versions of the plugin. - if (!!this.plugin && typeof this.plugin.setScaleToFit === 'function') - this.plugin.setScaleToFit(scaleToFit); -}; - - -/** - * Release all currently pressed keys. - */ -remoting.ClientPluginV1.prototype.releaseAllKeys = function() { - this.plugin.releaseAllKeys(); -}; - -/** - * Returns an associative array with a set of stats for this connection. - * - * @return {remoting.ClientSession.PerfStats} The connection statistics. - */ -remoting.ClientPluginV1.prototype.getPerfStats = function() { - /** @type {remoting.ClientSession.PerfStats} */ - return { videoBandwidth: this.plugin.videoBandwidth, - videoFrameRate: this.plugin.videoFrameRate, - captureLatency: this.plugin.videoCaptureLatency, - encodeLatency: this.plugin.videoEncodeLatency, - decodeLatency: this.plugin.videoDecodeLatency, - renderLatency: this.plugin.videoRenderLatency, - roundtripLatency: this.plugin.roundTripLatency }; -}; - -/** - * These dummy methods exist only so that this class implements ClientPlugin. - */ - -/** - * @param {string} mimeType - * @param {string} item - */ -remoting.ClientPluginV1.prototype.sendClipboardItem = function(mimeType, item) { - return; -}; - -/** - * @param {number} usbKeycode - * @param {boolean} pressed - */ -remoting.ClientPluginV1.prototype.injectKeyEvent = - function(usbKeycode, pressed) { - return; -}; - -/** - * @param {number} fromKeycode - * @param {number} toKeycode - */ -remoting.ClientPluginV1.prototype.remapKey = - function(fromKeycode, toKeycode) { - return; -}; - -/** - * @param {number} width - * @param {number} height - */ -remoting.ClientPluginV1.prototype.notifyClientDimensions = - function(width, height) { - return; -}; - -/** - * @param {boolean} pause - */ -remoting.ClientPluginV1.prototype.pauseVideo = - function(pause) { - return; -}; diff --git a/remoting/webapp/client_screen.js b/remoting/webapp/client_screen.js index 0abf493..baa7e56 100644 --- a/remoting/webapp/client_screen.js +++ b/remoting/webapp/client_screen.js @@ -456,24 +456,6 @@ function updateStatistics_() { } /** - * @return {boolean} true if the client plugin supports PIN auth. - */ -remoting.isPinAuthSupported = function () { - var plugin = /** @type {remoting.ViewerPlugin} */ - document.createElement('embed'); - plugin.src = 'about://none'; - plugin.type = 'pepper-application/x-chromoting'; - plugin.width = 0; - plugin.height = 0; - document.body.appendChild(plugin); - var version = plugin.apiVersion; - document.body.removeChild(plugin); - // Future version of the plugin will not have apiVersion. We assume - // that they support PINs. - return !version || version >= 4; -}; - -/** * Shows PIN entry screen. * * @param {string} hostId The unique id of the host. @@ -487,21 +469,16 @@ remoting.connectMe2Me = function(hostId, retryIfOffline) { remoting.hostId = hostId; remoting.retryIfOffline = retryIfOffline; - if (!remoting.isPinAuthSupported()) { - // Skip PIN prompt if it is not supported. - remoting.connectMe2MeWithPin(); - } else { - var host = remoting.hostList.getHostForId(remoting.hostId); - // If we're re-loading a tab for a host that has since been unregistered - // then the hostId may no longer resolve. - if (!host) { - showConnectError_(remoting.Error.HOST_IS_OFFLINE); - return; - } - var message = document.getElementById('pin-message'); - l10n.localizeElement(message, host.hostName); - remoting.setMode(remoting.AppMode.CLIENT_PIN_PROMPT); + var host = remoting.hostList.getHostForId(remoting.hostId); + // If we're re-loading a tab for a host that has since been unregistered + // then the hostId may no longer resolve. + if (!host) { + showConnectError_(remoting.Error.HOST_IS_OFFLINE); + return; } + var message = document.getElementById('pin-message'); + l10n.localizeElement(message, host.hostName); + remoting.setMode(remoting.AppMode.CLIENT_PIN_PROMPT); }; /** diff --git a/remoting/webapp/client_session.js b/remoting/webapp/client_session.js index a25befa..dc2cbf0 100644 --- a/remoting/webapp/client_session.js +++ b/remoting/webapp/client_session.js @@ -207,14 +207,7 @@ remoting.ClientSession.prototype.createClientPlugin_ = function(container, id) { plugin.tabIndex = 0; // Required, otherwise focus() doesn't work. container.appendChild(plugin); - // Previous versions of the plugin didn't support messaging-based - // interface. They can be identified by presence of apiVersion - // property that is less than 5. - if (plugin.apiVersion && plugin.apiVersion < 5) { - return new remoting.ClientPluginV1(plugin); - } else { - return new remoting.ClientPluginAsync(plugin); - } + return new remoting.ClientPluginAsync(plugin); }; /** @@ -614,7 +607,6 @@ remoting.ClientSession.prototype.updateDimensions = function() { parentNode.style.left + ',' + parentNode.style.top + '-' + width + 'x' + height + '.'); - this.plugin.setScaleToFit(this.getScaleToFit()); }; /** diff --git a/remoting/webapp/main.html b/remoting/webapp/main.html index 0607f93..1c1d822 100644 --- a/remoting/webapp/main.html +++ b/remoting/webapp/main.html @@ -19,7 +19,6 @@ found in the LICENSE file. <script src="host_setup_dialog.js"></script> <script src="client_plugin.js"></script> <script src="client_plugin_async.js"></script> - <script src="client_plugin_v1.js"></script> <script src="client_screen.js"></script> <script src="client_session.js"></script> <script src="clipboard.js"></script> diff --git a/remoting/webapp/viewer_plugin_proto.js b/remoting/webapp/viewer_plugin_proto.js index 6ccb7d9..67c13f0 100644 --- a/remoting/webapp/viewer_plugin_proto.js +++ b/remoting/webapp/viewer_plugin_proto.js @@ -15,64 +15,3 @@ remoting.ViewerPlugin = function() { }; /** @param {string} message The message to send to the host. */ remoting.ViewerPlugin.prototype.postMessage = function(message) {}; - -/** @param {string} iq The Iq stanza received from the host. */ -remoting.ViewerPlugin.prototype.onIq = function(iq) {}; - -/** Release all keys currently pressed by this client. */ -remoting.ViewerPlugin.prototype.releaseAllKeys = function() {}; - -/** - * @param {string} hostJid The host's JID. - * @param {string} hostPublicKey The host's public key. - * @param {string} clientJid The client's JID. - * @param {string} sharedSecret The access code for IT2Me or the - * PIN for Me2Me. - * @param {string=} authenticationMethod Comma-separated list of - * authentication methods the client should attempt to use. - * @param {string=} authenticationTag A host-specific tag to mix into - * authentication hashes. - * @return {void} Nothing. -*/ -remoting.ViewerPlugin.prototype.connect = - function(hostJid, hostPublicKey, clientJid, sharedSecret, - authenticationMethod, authenticationTag) {}; - -/** - * @param {boolean} scaleToFit New scaleToFit value. - */ -remoting.ViewerPlugin.prototype.setScaleToFit = function(scaleToFit) {}; - -/** @type {function(number, number): void} State change callback function. */ -remoting.ViewerPlugin.prototype.connectionInfoUpdate; - -/** @type {number} */ remoting.ViewerPlugin.prototype.apiMinVersion; -/** @type {number} */ remoting.ViewerPlugin.prototype.apiVersion; - -/** @type {number} */ remoting.ViewerPlugin.prototype.desktopHeight; -/** @type {number} */ remoting.ViewerPlugin.prototype.desktopWidth; - -/** @type {number} */ remoting.ViewerPlugin.prototype.status; -/** @type {number} */ remoting.ViewerPlugin.prototype.error; - -/** @type {number} */ remoting.ViewerPlugin.prototype.STATUS_UNKNOWN; -/** @type {number} */ remoting.ViewerPlugin.prototype.STATUS_CONNECTING; -/** @type {number} */ remoting.ViewerPlugin.prototype.STATUS_INITIALIZING; -/** @type {number} */ remoting.ViewerPlugin.prototype.STATUS_CONNECTED; -/** @type {number} */ remoting.ViewerPlugin.prototype.STATUS_CLOSED; -/** @type {number} */ remoting.ViewerPlugin.prototype.STATUS_FAILED; - -/** @type {number} */ remoting.ViewerPlugin.prototype.ERROR_NONE; -/** @type {number} */ remoting.ViewerPlugin.prototype.ERROR_HOST_IS_OFFLINE; -/** @type {number} */ remoting.ViewerPlugin.prototype.ERROR_SESSION_REJECTED; -/** @type {number} */ - remoting.ViewerPlugin.prototype.ERROR_INCOMPATIBLE_PROTOCOL; -/** @type {number} */ remoting.ViewerPlugin.prototype.ERROR_NETWORK_FAILURE; - -/** @type {number} */ remoting.ViewerPlugin.prototype.videoBandwidth; -/** @type {number} */ remoting.ViewerPlugin.prototype.videoCaptureLatency; -/** @type {number} */ remoting.ViewerPlugin.prototype.videoDecodeLatency; -/** @type {number} */ remoting.ViewerPlugin.prototype.videoEncodeLatency; -/** @type {number} */ remoting.ViewerPlugin.prototype.videoFrameRate; -/** @type {number} */ remoting.ViewerPlugin.prototype.videoRenderLatency; -/** @type {number} */ remoting.ViewerPlugin.prototype.roundTripLatency; |