Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** @suppress {duplicate} */ | 7 /** @suppress {duplicate} */ |
| 8 var remoting = remoting || {}; | 8 var remoting = remoting || {}; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 'chromeremotedesktop.dmg', | 42 'chromeremotedesktop.dmg', |
| 43 'Linux x86_64' : 'https://dl.google.com/linux/direct/' + | 43 'Linux x86_64' : 'https://dl.google.com/linux/direct/' + |
| 44 'chrome-remote-desktop_current_amd64.deb', | 44 'chrome-remote-desktop_current_amd64.deb', |
| 45 'Linux i386' : 'https://dl.google.com/linux/direct/' + | 45 'Linux i386' : 'https://dl.google.com/linux/direct/' + |
| 46 'chrome-remote-desktop_current_i386.deb' | 46 'chrome-remote-desktop_current_i386.deb' |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 /** | 49 /** |
| 50 * Starts downloading host components and shows installation prompt. | 50 * Starts downloading host components and shows installation prompt. |
| 51 * | 51 * |
| 52 * @param {remoting.HostController} hostController Used to install the host on | 52 * @param {remoting.HostPlugin} hostPlugin Used to install the host on Windows. |
| 53 * Windows. | |
| 54 * @param {function(remoting.HostController.AsyncResult):void} onDone Callback | 53 * @param {function(remoting.HostController.AsyncResult):void} onDone Callback |
| 55 * called when user clicks Ok, presumably after installing the host. The | 54 * called when user clicks Ok, presumably after installing the host. The |
| 56 * handler must verify that the host has been installed and call tryAgain() | 55 * handler must verify that the host has been installed and call tryAgain() |
| 57 * otherwise. | 56 * otherwise. |
| 58 * @param {function(remoting.Error):void} onError Callback called when user | 57 * @param {function(remoting.Error):void} onError Callback called when user |
| 59 * clicks Cancel button or there is some other unexpected error. | 58 * clicks Cancel button or there is some other unexpected error. |
| 60 * @return {void} | 59 * @return {void} |
| 61 */ | 60 */ |
| 62 remoting.HostInstallDialog.prototype.show = function( | 61 remoting.HostInstallDialog.prototype.show = function( |
| 63 hostController, onDone, onError) { | 62 hostPlugin, onDone, onError) { |
| 64 // On Windows, host installation is automatic (handled by the NPAPI plugin) | 63 // On Windows, host installation is automatic (handled by the NPAPI plugin) |
| 65 // and we don't show the dialog. On Mac and Linux, we show the dialog and the | 64 // and we don't show the dialog. On Mac and Linux, we show the dialog and the |
| 66 // user is expected to manually install the host before clicking OK. | 65 // user is expected to manually install the host before clicking OK. |
| 67 // TODO (weitaosu): Make host installation automatic for IT2Me (like Me2Me) on | 66 // TODO (weitaosu): Make host installation automatic for IT2Me (like Me2Me) on |
| 68 // Windows. Currently hostController is always null for IT2Me. | 67 // Windows. Currently hostController is always null for IT2Me. |
| 69 if (navigator.platform == 'Win32' && hostController != null) { | 68 if (navigator.platform == 'Win32' && hostPlugin != null) { |
| 70 hostController.installHost(onDone, onError); | 69 // Currently we show two dialogs (each with a UAC prompt) when a user |
| 70 // enables the host for the first time, one for installing the host (by the | |
| 71 // plugin) and the other for starting the host (by the native messaging | |
| 72 // host). We'd like to reduce it to one but don't have a good solution | |
| 73 // right now. | |
| 74 // We also show the same message on the two dialogs because. We don't want | |
| 75 // to confuse the user by saying "Installing Remote Desktop" because in | |
| 76 // their mind "Remote Deskto" (the webapp) has already been installed. | |
|
Jamie
2014/05/20 21:43:06
Nit: Typo 'Deskto'.
weitao
2014/05/20 22:09:13
Done.
| |
| 77 remoting.showSetupProcessingMessage(/*i18n-content*/'HOST_SETUP_STARTING'); | |
| 78 | |
| 79 hostPlugin.installHost(onDone); | |
| 71 } else { | 80 } else { |
| 72 this.continueInstallButton_.addEventListener( | 81 this.continueInstallButton_.addEventListener( |
| 73 'click', this.onOkClickedHandler_, false); | 82 'click', this.onOkClickedHandler_, false); |
| 74 this.cancelInstallButton_.addEventListener( | 83 this.cancelInstallButton_.addEventListener( |
| 75 'click', this.onCancelClickedHandler_, false); | 84 'click', this.onCancelClickedHandler_, false); |
| 76 remoting.setMode(remoting.AppMode.HOST_INSTALL_PROMPT); | 85 remoting.setMode(remoting.AppMode.HOST_INSTALL_PROMPT); |
| 77 | 86 |
| 78 var hostPackageUrl = | 87 var hostPackageUrl = |
| 79 remoting.HostInstallDialog.hostDownloadUrls[navigator.platform]; | 88 remoting.HostInstallDialog.hostDownloadUrls[navigator.platform]; |
| 80 if (hostPackageUrl === undefined) { | 89 if (hostPackageUrl === undefined) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 | 142 |
| 134 remoting.HostInstallDialog.prototype.onRetryClicked_ = function() { | 143 remoting.HostInstallDialog.prototype.onRetryClicked_ = function() { |
| 135 this.retryInstallButton_.removeEventListener( | 144 this.retryInstallButton_.removeEventListener( |
| 136 'click', this.onRetryClickedHandler_.bind(this), false); | 145 'click', this.onRetryClickedHandler_.bind(this), false); |
| 137 this.continueInstallButton_.addEventListener( | 146 this.continueInstallButton_.addEventListener( |
| 138 'click', this.onOkClickedHandler_, false); | 147 'click', this.onOkClickedHandler_, false); |
| 139 this.cancelInstallButton_.addEventListener( | 148 this.cancelInstallButton_.addEventListener( |
| 140 'click', this.onCancelClickedHandler_, false); | 149 'click', this.onCancelClickedHandler_, false); |
| 141 remoting.setMode(remoting.AppMode.HOST_INSTALL_PROMPT); | 150 remoting.setMode(remoting.AppMode.HOST_INSTALL_PROMPT); |
| 142 }; | 151 }; |
| OLD | NEW |