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

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

Issue 1020743002: [Chromoting] Move app-specific code out of remoting.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make isMe2MeInstallable private 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
« no previous file with comments | « remoting/webapp/crd/js/host_list.js ('k') | remoting/webapp/crd/js/local_host_section.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 this.state_ = remoting.HostSetupFlow.State.STOP_HOST_FAILED; 86 this.state_ = remoting.HostSetupFlow.State.STOP_HOST_FAILED;
87 } else { 87 } else {
88 // TODO(sergeyu): Add other error states and use them here. 88 // TODO(sergeyu): Add other error states and use them here.
89 this.state_ = remoting.HostSetupFlow.State.START_HOST_FAILED; 89 this.state_ = remoting.HostSetupFlow.State.START_HOST_FAILED;
90 } 90 }
91 } 91 }
92 }; 92 };
93 93
94 /** 94 /**
95 * @param {remoting.HostController} hostController The HostController 95 * @param {remoting.HostController} hostController The HostController
96 * responsible for the host daemon. 96 * responsible for the host daemon.
97 * @param {function(!remoting.Error)} onError Function to call when an error
98 * occurs.
97 * @constructor 99 * @constructor
98 */ 100 */
99 remoting.HostSetupDialog = function(hostController) { 101 remoting.HostSetupDialog = function(hostController, onError) {
100 this.hostController_ = hostController; 102 this.hostController_ = hostController;
103 this.onError_ = onError;
104
101 this.pinEntry_ = document.getElementById('daemon-pin-entry'); 105 this.pinEntry_ = document.getElementById('daemon-pin-entry');
102 this.pinConfirm_ = document.getElementById('daemon-pin-confirm'); 106 this.pinConfirm_ = document.getElementById('daemon-pin-confirm');
103 this.pinErrorDiv_ = document.getElementById('daemon-pin-error-div'); 107 this.pinErrorDiv_ = document.getElementById('daemon-pin-error-div');
104 this.pinErrorMessage_ = document.getElementById('daemon-pin-error-message'); 108 this.pinErrorMessage_ = document.getElementById('daemon-pin-error-message');
105 109
106 /** @type {remoting.HostSetupFlow} */ 110 /** @type {remoting.HostSetupFlow} */
107 this.flow_ = new remoting.HostSetupFlow([remoting.HostSetupFlow.State.NONE]); 111 this.flow_ = new remoting.HostSetupFlow([remoting.HostSetupFlow.State.NONE]);
108 112
109 /** @type {remoting.HostSetupDialog} */ 113 /** @type {remoting.HostSetupDialog} */
110 var that = this; 114 var that = this;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 162
159 /** 163 /**
160 * @param {remoting.HostController.State} state 164 * @param {remoting.HostController.State} state
161 */ 165 */
162 var onState = function(state) { 166 var onState = function(state) {
163 // Although we don't need an access token in order to start the host, 167 // Although we don't need an access token in order to start the host,
164 // using callWithToken here ensures consistent error handling in the 168 // using callWithToken here ensures consistent error handling in the
165 // case where the refresh token is invalid. 169 // case where the refresh token is invalid.
166 remoting.identity.getToken().then( 170 remoting.identity.getToken().then(
167 that.showForStartWithToken_.bind(that, state), 171 that.showForStartWithToken_.bind(that, state),
168 remoting.Error.handler(remoting.showErrorMessage)); 172 remoting.Error.handler(that.onError_));
169 }; 173 };
170 174
171 this.hostController_.getLocalHostState(onState); 175 this.hostController_.getLocalHostState(onState);
172 }; 176 };
173 177
174 /** 178 /**
175 * @param {remoting.HostController.State} state The current state of the local 179 * @param {remoting.HostController.State} state The current state of the local
176 * host. 180 * host.
177 * @param {string} token The OAuth2 token. 181 * @param {string} token The OAuth2 token.
178 * @private 182 * @private
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 var c = pin.charAt(i); 566 var c = pin.charAt(i);
563 if ((c < '0') || (c > '9')) { 567 if ((c < '0') || (c > '9')) {
564 return false; 568 return false;
565 } 569 }
566 } 570 }
567 return true; 571 return true;
568 }; 572 };
569 573
570 /** @type {remoting.HostSetupDialog} */ 574 /** @type {remoting.HostSetupDialog} */
571 remoting.hostSetupDialog = null; 575 remoting.hostSetupDialog = null;
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/host_list.js ('k') | remoting/webapp/crd/js/local_host_section.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698