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

Side by Side Diff: remoting/webapp/crd/js/host_install_dialog.js

Issue 955283002: Converted remoting.Error from an enum to a class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Requested changes. Created 5 years, 9 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 unified diff | Download patch
OLDNEW
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 12 matching lines...) Expand all
23 this.onOkClickedHandler_ = this.onOkClicked_.bind(this); 23 this.onOkClickedHandler_ = this.onOkClicked_.bind(this);
24 this.onCancelClickedHandler_ = this.onCancelClicked_.bind(this); 24 this.onCancelClickedHandler_ = this.onCancelClicked_.bind(this);
25 this.onRetryClickedHandler_ = this.onRetryClicked_.bind(this); 25 this.onRetryClickedHandler_ = this.onRetryClicked_.bind(this);
26 26
27 this.continueInstallButton_.disabled = false; 27 this.continueInstallButton_.disabled = false;
28 this.cancelInstallButton_.disabled = false; 28 this.cancelInstallButton_.disabled = false;
29 29
30 /** @private*/ 30 /** @private*/
31 this.onDoneHandler_ = function() {}; 31 this.onDoneHandler_ = function() {};
32 32
33 /** @param {remoting.Error} error @private */ 33 /** @param {!remoting.Error} error @private */
34 this.onErrorHandler_ = function(error) {}; 34 this.onErrorHandler_ = function(error) {};
35 35
36 /** 36 /**
37 * @type {remoting.HostInstaller} 37 * @type {remoting.HostInstaller}
38 * @private 38 * @private
39 */ 39 */
40 this.hostInstaller_ = new remoting.HostInstaller(); 40 this.hostInstaller_ = new remoting.HostInstaller();
41 }; 41 };
42 42
43 /** 43 /**
44 * Starts downloading host components and shows installation prompt. 44 * Starts downloading host components and shows installation prompt.
45 * 45 *
46 * @param {function():void} onDone Callback called when user clicks Ok, 46 * @param {function():void} onDone Callback called when user clicks Ok,
47 * presumably after installing the host. The handler must verify that the host 47 * presumably after installing the host. The handler must verify that the host
48 * has been installed and call tryAgain() otherwise. 48 * has been installed and call tryAgain() otherwise.
49 * @param {function(remoting.Error):void} onError Callback called when user 49 * @param {function(!remoting.Error):void} onError Callback called when user
50 * clicks Cancel button or there is some other unexpected error. 50 * clicks Cancel button or there is some other unexpected error.
51 * @return {void} 51 * @return {void}
52 */ 52 */
53 remoting.HostInstallDialog.prototype.show = function(onDone, onError) { 53 remoting.HostInstallDialog.prototype.show = function(onDone, onError) {
54 this.continueInstallButton_.addEventListener( 54 this.continueInstallButton_.addEventListener(
55 'click', this.onOkClickedHandler_, false); 55 'click', this.onOkClickedHandler_, false);
56 this.cancelInstallButton_.addEventListener( 56 this.cancelInstallButton_.addEventListener(
57 'click', this.onCancelClickedHandler_, false); 57 'click', this.onCancelClickedHandler_, false);
58 remoting.setMode(remoting.AppMode.HOST_INSTALL_PROMPT); 58 remoting.setMode(remoting.AppMode.HOST_INSTALL_PROMPT);
59 59
60 /** @type {function():void} */ 60 /** @type {function():void} */
61 this.onDoneHandler_ = onDone; 61 this.onDoneHandler_ = onDone;
62 62
63 /** @type {function(remoting.Error):void} */ 63 /** @type {function(!remoting.Error):void} */
64 this.onErrorHandler_ = onError; 64 this.onErrorHandler_ = onError;
65 65
66 /** @type {remoting.HostInstaller} */ 66 /** @type {remoting.HostInstaller} */
67 var hostInstaller = new remoting.HostInstaller(); 67 var hostInstaller = new remoting.HostInstaller();
68 68
69 /** @type {remoting.HostInstallDialog} */ 69 /** @type {remoting.HostInstallDialog} */
70 var that = this; 70 var that = this;
71 71
72 this.hostInstaller_.downloadAndWaitForInstall().then(function() { 72 this.hostInstaller_.downloadAndWaitForInstall().then(function() {
73 that.continueInstallButton_.click(); 73 that.continueInstallButton_.click();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 remoting.HostInstallDialog.prototype.onRetryClicked_ = function() { 114 remoting.HostInstallDialog.prototype.onRetryClicked_ = function() {
115 this.retryInstallButton_.removeEventListener( 115 this.retryInstallButton_.removeEventListener(
116 'click', this.onRetryClickedHandler_.bind(this), false); 116 'click', this.onRetryClickedHandler_.bind(this), false);
117 this.continueInstallButton_.addEventListener( 117 this.continueInstallButton_.addEventListener(
118 'click', this.onOkClickedHandler_, false); 118 'click', this.onOkClickedHandler_, false);
119 this.cancelInstallButton_.addEventListener( 119 this.cancelInstallButton_.addEventListener(
120 'click', this.onCancelClickedHandler_, false); 120 'click', this.onCancelClickedHandler_, false);
121 remoting.setMode(remoting.AppMode.HOST_INSTALL_PROMPT); 121 remoting.setMode(remoting.AppMode.HOST_INSTALL_PROMPT);
122 }; 122 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698