OLD | NEW |
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 /** @type {remoting.HostSetupDialog} */ | 156 /** @type {remoting.HostSetupDialog} */ |
157 var that = this; | 157 var that = this; |
158 | 158 |
159 /** | 159 /** |
160 * @param {remoting.HostController.State} state | 160 * @param {remoting.HostController.State} state |
161 */ | 161 */ |
162 var onState = function(state) { | 162 var onState = function(state) { |
163 // Although we don't need an access token in order to start the host, | 163 // Although we don't need an access token in order to start the host, |
164 // using callWithToken here ensures consistent error handling in the | 164 // using callWithToken here ensures consistent error handling in the |
165 // case where the refresh token is invalid. | 165 // case where the refresh token is invalid. |
166 remoting.identity.callWithToken( | 166 remoting.identity.getToken().then( |
167 that.showForStartWithToken_.bind(that, state), | 167 that.showForStartWithToken_.bind(that, state), |
168 remoting.showErrorMessage); | 168 remoting.Error.handler(remoting.showErrorMessage)); |
169 }; | 169 }; |
170 | 170 |
171 this.hostController_.getLocalHostState(onState); | 171 this.hostController_.getLocalHostState(onState); |
172 }; | 172 }; |
173 | 173 |
174 /** | 174 /** |
175 * @param {remoting.HostController.State} state The current state of the local | 175 * @param {remoting.HostController.State} state The current state of the local |
176 * host. | 176 * host. |
177 * @param {string} token The OAuth2 token. | 177 * @param {string} token The OAuth2 token. |
178 * @private | 178 * @private |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 var c = pin.charAt(i); | 562 var c = pin.charAt(i); |
563 if ((c < '0') || (c > '9')) { | 563 if ((c < '0') || (c > '9')) { |
564 return false; | 564 return false; |
565 } | 565 } |
566 } | 566 } |
567 return true; | 567 return true; |
568 }; | 568 }; |
569 | 569 |
570 /** @type {remoting.HostSetupDialog} */ | 570 /** @type {remoting.HostSetupDialog} */ |
571 remoting.hostSetupDialog = null; | 571 remoting.hostSetupDialog = null; |
OLD | NEW |