Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Unified Diff: remoting/webapp/host_install_dialog.js

Issue 466143003: Hangouts remote desktop part IV - Host installer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/remoting_webapp_files.gypi ('k') | remoting/webapp/host_installer.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/host_install_dialog.js
diff --git a/remoting/webapp/host_install_dialog.js b/remoting/webapp/host_install_dialog.js
index 37e5e6b7d49de8cb5101623576cabc3275e15913..ab072e830eecafb866a892183a70526a8714be51 100644
--- a/remoting/webapp/host_install_dialog.js
+++ b/remoting/webapp/host_install_dialog.js
@@ -28,22 +28,16 @@ remoting.HostInstallDialog = function() {
this.cancelInstallButton_.disabled = false;
/** @private*/
- this.onDoneHandler_ = function() {}
+ this.onDoneHandler_ = function() {};
/** @param {remoting.Error} error @private */
- this.onErrorHandler_ = function(error) {}
-};
+ this.onErrorHandler_ = function(error) {};
-/** @type {Object.<string,string>} */
-remoting.HostInstallDialog.hostDownloadUrls = {
- 'Win32' : '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'
+ /**
+ * @type {remoting.HostInstaller}
+ * @private
+ */
+ this.hostInstaller_ = new remoting.HostInstaller();
};
/**
@@ -63,28 +57,26 @@ remoting.HostInstallDialog.prototype.show = function(onDone, onError) {
'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():void} */
this.onDoneHandler_ = onDone;
/** @type {function(remoting.Error):void} */
this.onErrorHandler_ = onError;
-}
+
+ /** @type {remoting.HostInstaller} */
+ var hostInstaller = new remoting.HostInstaller();
+
+ /** @type {remoting.HostInstallDialog} */
+ var that = this;
+
+ this.hostInstaller_.downloadAndWaitForInstall().then(function() {
+ that.continueInstallButton_.click();
+ that.hostInstaller_.cancel();
+ }, function(){
+ that.onErrorHandler_(remoting.Error.CANCELLED);
+ that.hostInstaller_.cancel();
+ });
+};
/**
* In manual host installation, onDone handler must call this method if it
@@ -108,15 +100,16 @@ remoting.HostInstallDialog.prototype.onOkClicked_ = function() {
this.cancelInstallButton_.disabled = true;
this.onDoneHandler_();
-}
+};
remoting.HostInstallDialog.prototype.onCancelClicked_ = function() {
this.continueInstallButton_.removeEventListener(
'click', this.onOkClickedHandler_, false);
this.cancelInstallButton_.removeEventListener(
'click', this.onCancelClickedHandler_, false);
+ this.hostInstaller_.cancel();
this.onErrorHandler_(remoting.Error.CANCELLED);
-}
+};
remoting.HostInstallDialog.prototype.onRetryClicked_ = function() {
this.retryInstallButton_.removeEventListener(
« no previous file with comments | « remoting/remoting_webapp_files.gypi ('k') | remoting/webapp/host_installer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698