Chromium Code Reviews| Index: remoting/webapp/crd/js/host_installer.js |
| diff --git a/remoting/webapp/crd/js/host_installer.js b/remoting/webapp/crd/js/host_installer.js |
| index 8ae9b36b659c14631339de4fb9eff37ed88d4ff8..36b8d928b3e6669bfadbb93a5516e03cad4c9dee 100644 |
| --- a/remoting/webapp/crd/js/host_installer.js |
| +++ b/remoting/webapp/crd/js/host_installer.js |
| @@ -78,28 +78,40 @@ remoting.HostInstaller.prototype.isInstalled = function() { |
| }); |
| }; |
| +/** @type {Object.<string,string>} */ |
| +remoting.HostInstaller.HOST_DOWNLOAD_URLS = { |
|
kelvinp
2015/01/23 21:15:33
With the new JS Compiler, you can make this truly
Sergey Ulanov
2015/01/23 21:26:19
Done.
|
| + 'Win32': 'http://dl.google.com/dl/edgedl/chrome-remote-desktop/' + |
| + 'chromeremotedesktophost.msi', |
| + 'Win64': 'http://dl.google.com/dl/edgedl/chrome-remote-desktop/' + |
| + 'chromeremotedesktophost.msi', |
| + 'MacIntel': 'https://dl.google.com/chrome-remote-desktop/' + |
| + 'chromeremotedesktop.dmg', |
| + 'Linux x86_64': 'https://dl.google.com/linux/direct/' + |
| + 'chrome-remote-desktop_current_amd64.deb', |
| + 'Linux i386': 'https://dl.google.com/linux/direct/' + |
| + 'chrome-remote-desktop_current_i386.deb', |
| + 'Linux i686': 'https://dl.google.com/linux/direct/' + |
| + 'chrome-remote-desktop_current_i386.deb' |
| +}; |
| + |
| +/** |
| + * Returns true if the host is installable on the current platform. |
| + * @returns {boolean} |
| + */ |
| +remoting.HostInstaller.canInstall = function() { |
| + return !!remoting.HostInstaller.HOST_DOWNLOAD_URLS[navigator.platform]; |
| +}; |
| + |
| /** |
| * @throws {Error} Throws if there is no matching host binary for the current |
| * platform. |
| */ |
| remoting.HostInstaller.prototype.download = function() { |
| - /** @type {Object.<string,string>} */ |
| - var hostDownloadUrls = { |
| - 'Win32' : 'http://dl.google.com/dl/edgedl/chrome-remote-desktop/' + |
| - 'chromeremotedesktophost.msi', |
| - 'Win64' : 'http://dl.google.com/dl/edgedl/chrome-remote-desktop/' + |
| - 'chromeremotedesktophost.msi', |
| - 'MacIntel' : 'https://dl.google.com/chrome-remote-desktop/' + |
| - 'chromeremotedesktop.dmg', |
| - 'Linux x86_64' : 'https://dl.google.com/linux/direct/' + |
| - 'chrome-remote-desktop_current_amd64.deb', |
| - 'Linux i386' : 'https://dl.google.com/linux/direct/' + |
| - 'chrome-remote-desktop_current_i386.deb' |
| - }; |
| - |
| - var hostPackageUrl = hostDownloadUrls[navigator.platform]; |
| + var hostPackageUrl = |
| + remoting.HostInstaller.HOST_DOWNLOAD_URLS[navigator.platform]; |
| if (hostPackageUrl === undefined) { |
| - throw new Error(remoting.Error.CANCELLED); |
| + console.error("Tried to install host on " + navigator.platform); |
| + throw new Error(remoting.Error.UNEXPECTED); |
| } |
| // Start downloading the package. |