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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 remoting.setMode(remoting.AppMode.HOST_INSTALL_PROMPT); | 76 remoting.setMode(remoting.AppMode.HOST_INSTALL_PROMPT); |
77 | 77 |
78 var hostPackageUrl = | 78 var hostPackageUrl = |
79 remoting.HostInstallDialog.hostDownloadUrls[navigator.platform]; | 79 remoting.HostInstallDialog.hostDownloadUrls[navigator.platform]; |
80 if (hostPackageUrl === undefined) { | 80 if (hostPackageUrl === undefined) { |
81 this.onErrorHandler_(remoting.Error.CANCELLED); | 81 this.onErrorHandler_(remoting.Error.CANCELLED); |
82 return; | 82 return; |
83 } | 83 } |
84 | 84 |
85 // Start downloading the package. | 85 // Start downloading the package. |
86 window.location = hostPackageUrl; | 86 if (remoting.isAppsV2) { |
| 87 // TODO(jamiewalch): Use chrome.downloads when it is available to |
| 88 // apps v2 (http://crbug.com/174046) |
| 89 window.open(hostPackageUrl); |
| 90 } else { |
| 91 window.location = hostPackageUrl; |
| 92 } |
87 | 93 |
88 /** @type {function(remoting.HostController.AsyncResult):void} */ | 94 /** @type {function(remoting.HostController.AsyncResult):void} */ |
89 this.onDoneHandler_ = onDone; | 95 this.onDoneHandler_ = onDone; |
90 | 96 |
91 /** @type {function(remoting.Error):void} */ | 97 /** @type {function(remoting.Error):void} */ |
92 this.onErrorHandler_ = onError; | 98 this.onErrorHandler_ = onError; |
93 } | 99 } |
94 } | 100 } |
95 | 101 |
96 /** | 102 /** |
(...skipping 30 matching lines...) Expand all Loading... |
127 | 133 |
128 remoting.HostInstallDialog.prototype.onRetryClicked_ = function() { | 134 remoting.HostInstallDialog.prototype.onRetryClicked_ = function() { |
129 this.retryInstallButton_.removeEventListener( | 135 this.retryInstallButton_.removeEventListener( |
130 'click', this.onRetryClickedHandler_.bind(this), false); | 136 'click', this.onRetryClickedHandler_.bind(this), false); |
131 this.continueInstallButton_.addEventListener( | 137 this.continueInstallButton_.addEventListener( |
132 'click', this.onOkClickedHandler_, false); | 138 'click', this.onOkClickedHandler_, false); |
133 this.cancelInstallButton_.addEventListener( | 139 this.cancelInstallButton_.addEventListener( |
134 'click', this.onCancelClickedHandler_, false); | 140 'click', this.onCancelClickedHandler_, false); |
135 remoting.setMode(remoting.AppMode.HOST_INSTALL_PROMPT); | 141 remoting.setMode(remoting.AppMode.HOST_INSTALL_PROMPT); |
136 }; | 142 }; |
137 | |
OLD | NEW |