Chromium Code Reviews| Index: remoting/webapp/host_install_dialog.js |
| diff --git a/remoting/webapp/host_install_dialog.js b/remoting/webapp/host_install_dialog.js |
| index 448b2d7bfe26681065d9ac379dd486181aee9d23..37e5e6b7d49de8cb5101623576cabc3275e15913 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*/ |
|
Sergey Ulanov
2014/05/24 01:50:34
nit: space before */
|
| + 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() { |