diff options
author | weitaosu@chromium.org <weitaosu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-24 12:45:17 +0000 |
---|---|---|
committer | weitaosu@chromium.org <weitaosu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-24 12:45:17 +0000 |
commit | ba6498b0fb3d7e7384087a05b4dc16b8054086d5 (patch) | |
tree | 8d585311f66e7467abc0cb758427ce700965ff88 /remoting/webapp | |
parent | d823e370f31b6dfb96cc90bf07ec4480c40f7135 (diff) | |
download | chromium_src-ba6498b0fb3d7e7384087a05b4dc16b8054086d5.zip chromium_src-ba6498b0fb3d7e7384087a05b4dc16b8054086d5.tar.gz chromium_src-ba6498b0fb3d7e7384087a05b4dc16b8054086d5.tar.bz2 |
Remove the NPAPI plugin from the webapp.
This change removes the NPAPI plugin from the webapp and switch Windows to use the Mac workflow where the user is prompted to download and install the host manually.
The removal of the dispatching code and the NPAPI target will be done in later CLs.
BUG=377046
Review URL: https://codereview.chromium.org/299983002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272722 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/webapp')
-rw-r--r-- | remoting/webapp/host_install_dialog.js | 86 | ||||
-rw-r--r-- | remoting/webapp/host_screen.js | 23 | ||||
-rw-r--r-- | remoting/webapp/host_setup_dialog.js | 26 | ||||
-rw-r--r-- | remoting/webapp/manifest.json.jinja2 | 40 | ||||
-rw-r--r-- | remoting/webapp/remoting.js | 9 |
5 files changed, 58 insertions, 126 deletions
diff --git a/remoting/webapp/host_install_dialog.js b/remoting/webapp/host_install_dialog.js index 448b2d7..37e5e6b 100644 --- a/remoting/webapp/host_install_dialog.js +++ b/remoting/webapp/host_install_dialog.js @@ -27,8 +27,8 @@ remoting.HostInstallDialog = function() { this.continueInstallButton_.disabled = false; this.cancelInstallButton_.disabled = false; - /** @param {remoting.HostController.AsyncResult} asyncResult @private*/ - this.onDoneHandler_ = function(asyncResult) {} + /** @private*/ + this.onDoneHandler_ = function() {} /** @param {remoting.Error} error @private */ this.onErrorHandler_ = function(error) {} @@ -49,63 +49,41 @@ remoting.HostInstallDialog.hostDownloadUrls = { /** * Starts downloading host components and shows installation prompt. * - * @param {remoting.HostPlugin} hostPlugin Used to install the host on Windows. - * @param {function(remoting.HostController.AsyncResult):void} onDone Callback - * called when user clicks Ok, presumably after installing the host. The - * handler must verify that the host has been installed and call tryAgain() - * otherwise. + * @param {function():void} onDone Callback called when user clicks Ok, + * presumably after installing the host. The handler must verify that the host + * has been installed and call tryAgain() otherwise. * @param {function(remoting.Error):void} onError Callback called when user * clicks Cancel button or there is some other unexpected error. * @return {void} */ -remoting.HostInstallDialog.prototype.show = function( - hostPlugin, onDone, onError) { - // On Windows, host installation is automatic (handled by the NPAPI plugin) - // and we don't show the dialog. On Mac and Linux, we show the dialog and the - // user is expected to manually install the host before clicking OK. - // TODO (weitaosu): Make host installation automatic for IT2Me (like Me2Me) on - // Windows. Currently hostController is always null for IT2Me. - if (navigator.platform == 'Win32' && hostPlugin != null) { - // Currently we show two dialogs (each with a UAC prompt) when a user - // enables the host for the first time, one for installing the host (by the - // plugin) and the other for starting the host (by the native messaging - // host). We'd like to reduce it to one but don't have a good solution - // right now. - // We also show the same message on the two dialogs because. We don't want - // to confuse the user by saying "Installing Remote Desktop" because in - // their mind "Remote Desktop" (the webapp) has already been installed. - remoting.showSetupProcessingMessage(/*i18n-content*/'HOST_SETUP_STARTING'); - - hostPlugin.installHost(onDone); +remoting.HostInstallDialog.prototype.show = function(onDone, onError) { + this.continueInstallButton_.addEventListener( + 'click', this.onOkClickedHandler_, false); + this.cancelInstallButton_.addEventListener( + 'click', this.onCancelClickedHandler_, false); + remoting.setMode(remoting.AppMode.HOST_INSTALL_PROMPT); + + var hostPackageUrl = + remoting.HostInstallDialog.hostDownloadUrls[navigator.platform]; + if (hostPackageUrl === undefined) { + this.onErrorHandler_(remoting.Error.CANCELLED); + return; + } + + // Start downloading the package. + if (remoting.isAppsV2) { + // TODO(jamiewalch): Use chrome.downloads when it is available to + // apps v2 (http://crbug.com/174046) + window.open(hostPackageUrl); } else { - this.continueInstallButton_.addEventListener( - 'click', this.onOkClickedHandler_, false); - this.cancelInstallButton_.addEventListener( - 'click', this.onCancelClickedHandler_, false); - remoting.setMode(remoting.AppMode.HOST_INSTALL_PROMPT); - - var hostPackageUrl = - remoting.HostInstallDialog.hostDownloadUrls[navigator.platform]; - if (hostPackageUrl === undefined) { - this.onErrorHandler_(remoting.Error.CANCELLED); - return; - } - - // Start downloading the package. - if (remoting.isAppsV2) { - // TODO(jamiewalch): Use chrome.downloads when it is available to - // apps v2 (http://crbug.com/174046) - window.open(hostPackageUrl); - } else { - window.location = hostPackageUrl; - } - - /** @type {function(remoting.HostController.AsyncResult):void} */ - this.onDoneHandler_ = onDone; - - /** @type {function(remoting.Error):void} */ - this.onErrorHandler_ = onError; + window.location = hostPackageUrl; } + + /** @type {function():void} */ + this.onDoneHandler_ = onDone; + + /** @type {function(remoting.Error):void} */ + this.onErrorHandler_ = onError; } /** @@ -129,7 +107,7 @@ remoting.HostInstallDialog.prototype.onOkClicked_ = function() { this.continueInstallButton_.disabled = true; this.cancelInstallButton_.disabled = true; - this.onDoneHandler_(remoting.HostController.AsyncResult.OK); + this.onDoneHandler_(); } remoting.HostInstallDialog.prototype.onCancelClicked_ = function() { diff --git a/remoting/webapp/host_screen.js b/remoting/webapp/host_screen.js index 71446ae..285fa99 100644 --- a/remoting/webapp/host_screen.js +++ b/remoting/webapp/host_screen.js @@ -44,26 +44,10 @@ remoting.tryShare = function() { document.getElementById('host-plugin-container')); } - /** @param {remoting.HostController.AsyncResult} asyncResult */ - var onHostInstalled = function(asyncResult) { - if (asyncResult == remoting.HostController.AsyncResult.OK) { - tryInitializeDispatcher(); - } else if (asyncResult == remoting.HostController.AsyncResult.CANCELLED) { - onInstallError(remoting.Error.CANCELLED); - } else { - onInstallError(remoting.Error.UNEXPECTED); - } - }; - var onDispatcherInitialized = function () { if (hostDispatcher.usingNpapi()) { hostInstallDialog = new remoting.HostInstallDialog(); - if (navigator.platform == 'Win32') { - hostInstallDialog.show( - hostDispatcher.getNpapiHost(), onHostInstalled, onInstallError); - } else { - hostInstallDialog.show(null, onHostInstalled, onInstallError); - } + hostInstallDialog.show(tryInitializeDispatcher, onInstallError); } else { // Host alrady installed. remoting.startHostUsingDispatcher_(hostDispatcher); @@ -82,10 +66,9 @@ remoting.tryShare = function() { if (hostInstallDialog == null) { hostInstallDialog = new remoting.HostInstallDialog(); - (/** @type {remoting.HostInstallDialog} */ hostInstallDialog).show( - null, onHostInstalled, onInstallError); + hostInstallDialog.show(tryInitializeDispatcher, onInstallError); } else { - (/** @type {remoting.HostInstallDialog} */ hostInstallDialog).tryAgain(); + hostInstallDialog.tryAgain(); } }; diff --git a/remoting/webapp/host_setup_dialog.js b/remoting/webapp/host_setup_dialog.js index bf950ba..4697c900 100644 --- a/remoting/webapp/host_setup_dialog.js +++ b/remoting/webapp/host_setup_dialog.js @@ -353,15 +353,8 @@ remoting.HostSetupDialog.prototype.installHost_ = function() { that.updateState_(); }; - /** @param {remoting.HostController.AsyncResult} asyncResult */ - var onDone = function(asyncResult) { - if (asyncResult == remoting.HostController.AsyncResult.OK) { - that.hostController_.getLocalHostState(onHostState); - } else if (asyncResult == remoting.HostController.AsyncResult.CANCELLED) { - onError(remoting.Error.CANCELLED); - } else { - onError(remoting.Error.UNEXPECTED); - } + var onDone = function() { + that.hostController_.getLocalHostState(onHostState); }; /** @param {remoting.HostController.State} state */ @@ -374,23 +367,14 @@ remoting.HostSetupDialog.prototype.installHost_ = function() { that.flow_.switchToNextStep(); that.updateState_(); } else { - // For Mac/Linux, prompt the user again if the host is not installed. - if (navigator.platform != 'Win32') { - hostInstallDialog.tryAgain(); - } else { - // For Windows, report an error in the unlikely case that - // HostController.installHost reports AsyncResult.OK but the host is not - // installed. - console.error('The chromoting host is not installed.'); - onError(remoting.Error.UNEXPECTED); - } + // Prompt the user again if the host is not installed. + hostInstallDialog.tryAgain(); } }; /** @type {remoting.HostInstallDialog} */ var hostInstallDialog = new remoting.HostInstallDialog(); - hostInstallDialog.show( - this.hostController_.getDispatcher().getNpapiHost(), onDone, onError); + hostInstallDialog.show(onDone, onError); } /** diff --git a/remoting/webapp/manifest.json.jinja2 b/remoting/webapp/manifest.json.jinja2 index 81c676b..ed3907c 100644 --- a/remoting/webapp/manifest.json.jinja2 +++ b/remoting/webapp/manifest.json.jinja2 @@ -42,6 +42,19 @@ "optional_permissions": [ "<all_urls>" ], + +{% if webapp_type != 'v1' %} + "oauth2": { + "client_id": "{{ REMOTING_IDENTITY_API_CLIENT_ID }}", + "scopes": [ + "https://www.googleapis.com/auth/chromoting https://www.googleapis.com/auth/googletalk https://www.googleapis.com/auth/userinfo#email" + ] + }, + "sandbox": { + "pages": [ "wcs_sandbox.html" ] + }, +{% endif %} + "permissions": [ "{{ OAUTH2_ACCOUNTS_HOST }}/*", "{{ OAUTH2_API_BASE_URL }}/*", @@ -72,30 +85,5 @@ ] } {% endif %} - ], - -{% if webapp_type == 'v1' %} - "plugins": [ - { "path": "remoting_host_plugin.dll", "public": false }, - { "path": "libremoting_host_plugin.ia32.so", "public": false }, - { "path": "libremoting_host_plugin.x64.so", "public": false }, - { "path": "remoting_host_plugin.plugin", "public": false } - ], - "requirements": { - "plugins": { - "npapi": false - } - } -{% else %} - "oauth2": { - "client_id": "{{ REMOTING_IDENTITY_API_CLIENT_ID }}", - "scopes": [ - "https://www.googleapis.com/auth/chromoting https://www.googleapis.com/auth/googletalk https://www.googleapis.com/auth/userinfo#email" - ] - }, - "sandbox": { - "pages": [ "wcs_sandbox.html" ] - } -{% endif %} - + ] } diff --git a/remoting/webapp/remoting.js b/remoting/webapp/remoting.js index adc26a7..52357f7 100644 --- a/remoting/webapp/remoting.js +++ b/remoting/webapp/remoting.js @@ -190,15 +190,14 @@ remoting.createNpapiPlugin = function(container) { // Hiding the plugin means it doesn't load, so make it size zero instead. plugin.width = 0; plugin.height = 0; - container.appendChild(plugin); // Verify if the plugin was loaded successfully. - if (!plugin.hasOwnProperty('REQUESTED_ACCESS_CODE')) { - container.removeChild(plugin); - return null; + if (plugin.hasOwnProperty('REQUESTED_ACCESS_CODE')) { + container.appendChild(plugin); + return /** @type {remoting.HostPlugin} */ (plugin); } - return /** @type {remoting.HostPlugin} */ (plugin); + return null; }; /** |