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 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * | 7 * |
8 * HostInstaller allows the caller to download the host binary and monitor the | 8 * HostInstaller allows the caller to download the host binary and monitor the |
9 * install progress of the host by pinging the host periodically via native | 9 * install progress of the host by pinging the host periodically via native |
10 * messaging. | 10 * messaging. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 }; | 99 }; |
100 | 100 |
101 /** | 101 /** |
102 * @throws {Error} Throws if there is no matching host binary for the current | 102 * @throws {Error} Throws if there is no matching host binary for the current |
103 * platform. | 103 * platform. |
104 */ | 104 */ |
105 remoting.HostInstaller.prototype.download = function() { | 105 remoting.HostInstaller.prototype.download = function() { |
106 var hostPackageUrl = HOST_DOWNLOAD_URLS[navigator.platform]; | 106 var hostPackageUrl = HOST_DOWNLOAD_URLS[navigator.platform]; |
107 if (hostPackageUrl === undefined) { | 107 if (hostPackageUrl === undefined) { |
108 console.error("Tried to install host on " + navigator.platform); | 108 console.error("Tried to install host on " + navigator.platform); |
109 throw new Error(remoting.Error.UNEXPECTED); | 109 throw new Error(remoting.Error.unexpected()); |
110 } | 110 } |
111 | 111 |
112 // Start downloading the package. | 112 // Start downloading the package. |
113 if (base.isAppsV2()) { | 113 if (base.isAppsV2()) { |
114 // TODO(jamiewalch): Use chrome.downloads when it is available to | 114 // TODO(jamiewalch): Use chrome.downloads when it is available to |
115 // apps v2 (http://crbug.com/174046) | 115 // apps v2 (http://crbug.com/174046) |
116 window.open(hostPackageUrl); | 116 window.open(hostPackageUrl); |
117 } else { | 117 } else { |
118 window.location = hostPackageUrl; | 118 window.location = hostPackageUrl; |
119 } | 119 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 */ | 165 */ |
166 remoting.HostInstaller.prototype.cancel = function() { | 166 remoting.HostInstaller.prototype.cancel = function() { |
167 if (this.checkInstallIntervalId_ !== null) { | 167 if (this.checkInstallIntervalId_ !== null) { |
168 window.clearInterval(this.checkInstallIntervalId_); | 168 window.clearInterval(this.checkInstallIntervalId_); |
169 this.checkInstallIntervalId_ = null; | 169 this.checkInstallIntervalId_ = null; |
170 } | 170 } |
171 this.downloadAndWaitForInstallPromise_ = null; | 171 this.downloadAndWaitForInstallPromise_ = null; |
172 }; | 172 }; |
173 | 173 |
174 })(); | 174 })(); |
OLD | NEW |