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 /** @constructor */ | 10 /** @constructor */ |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 * @param {string} hostName | 233 * @param {string} hostName |
234 * @param {string} publicKey | 234 * @param {string} publicKey |
235 * @param {string} privateKey | 235 * @param {string} privateKey |
236 * @param {XMLHttpRequest} xhr | 236 * @param {XMLHttpRequest} xhr |
237 */ | 237 */ |
238 function onRegistered( | 238 function onRegistered( |
239 hostName, publicKey, privateKey, xhr) { | 239 hostName, publicKey, privateKey, xhr) { |
240 var success = (xhr.status == 200); | 240 var success = (xhr.status == 200); |
241 | 241 |
242 if (success) { | 242 if (success) { |
243 var result = jsonParseSafe(xhr.responseText); | 243 var result = base.jsonParseSafe(xhr.responseText); |
244 if ('data' in result && 'authorizationCode' in result['data']) { | 244 if ('data' in result && 'authorizationCode' in result['data']) { |
245 that.hostDaemonFacade_.getCredentialsFromAuthCode( | 245 that.hostDaemonFacade_.getCredentialsFromAuthCode( |
246 result['data']['authorizationCode'], | 246 result['data']['authorizationCode'], |
247 onServiceAccountCredentials.bind( | 247 onServiceAccountCredentials.bind( |
248 null, hostName, publicKey, privateKey), | 248 null, hostName, publicKey, privateKey), |
249 onError); | 249 onError); |
250 } else { | 250 } else { |
251 // No authorization code returned, use regular user credential flow. | 251 // No authorization code returned, use regular user credential flow. |
252 that.hostDaemonFacade_.getPinHash( | 252 that.hostDaemonFacade_.getPinHash( |
253 newHostId, hostPin, startHostWithHash.bind( | 253 newHostId, hostPin, startHostWithHash.bind( |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 function connectSignalingWithTokenAndEmail(token, email) { | 568 function connectSignalingWithTokenAndEmail(token, email) { |
569 signalStrategy.connect( | 569 signalStrategy.connect( |
570 remoting.settings.XMPP_SERVER_ADDRESS, email, token); | 570 remoting.settings.XMPP_SERVER_ADDRESS, email, token); |
571 } | 571 } |
572 | 572 |
573 remoting.identity.callWithToken(connectSignalingWithToken, onError); | 573 remoting.identity.callWithToken(connectSignalingWithToken, onError); |
574 }; | 574 }; |
575 | 575 |
576 /** @type {remoting.HostController} */ | 576 /** @type {remoting.HostController} */ |
577 remoting.hostController = null; | 577 remoting.hostController = null; |
OLD | NEW |