| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * Connect set-up state machine for Me2Me and IT2Me | 7 * Connect set-up state machine for Me2Me and IT2Me |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 /** | 329 /** |
| 330 * Get host ID. | 330 * Get host ID. |
| 331 * | 331 * |
| 332 * @return {string} | 332 * @return {string} |
| 333 */ | 333 */ |
| 334 remoting.SessionConnector.prototype.getHostId = function() { | 334 remoting.SessionConnector.prototype.getHostId = function() { |
| 335 return this.hostId_; | 335 return this.hostId_; |
| 336 }; | 336 }; |
| 337 | 337 |
| 338 /** | 338 /** |
| 339 * Get host display name. |
| 340 * |
| 341 * @return {string} |
| 342 */ |
| 343 remoting.SessionConnector.prototype.getHostDisplayName = function() { |
| 344 return this.hostDisplayName_; |
| 345 }; |
| 346 |
| 347 /** |
| 339 * Continue an IT2Me connection once an access token has been obtained. | 348 * Continue an IT2Me connection once an access token has been obtained. |
| 340 * | 349 * |
| 341 * @param {string} token An OAuth2 access token. | 350 * @param {string} token An OAuth2 access token. |
| 342 * @return {void} Nothing. | 351 * @return {void} Nothing. |
| 343 * @private | 352 * @private |
| 344 */ | 353 */ |
| 345 remoting.SessionConnector.prototype.connectIT2MeWithToken_ = function(token) { | 354 remoting.SessionConnector.prototype.connectIT2MeWithToken_ = function(token) { |
| 346 // Resolve the host id to get the host JID. | 355 // Resolve the host id to get the host JID. |
| 347 this.pendingXhr_ = remoting.xhr.get( | 356 this.pendingXhr_ = remoting.xhr.get( |
| 348 remoting.settings.DIRECTORY_API_BASE_URL + '/support-hosts/' + | 357 remoting.settings.DIRECTORY_API_BASE_URL + '/support-hosts/' + |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 // in a new clientJid and a new callback. In this case, remove the old | 395 // in a new clientJid and a new callback. In this case, remove the old |
| 387 // client plugin before instantiating a new one. | 396 // client plugin before instantiating a new one. |
| 388 if (this.clientSession_) { | 397 if (this.clientSession_) { |
| 389 this.clientSession_.removePlugin(); | 398 this.clientSession_.removePlugin(); |
| 390 this.clientSession_ = null; | 399 this.clientSession_ = null; |
| 391 } | 400 } |
| 392 | 401 |
| 393 var authenticationMethods = | 402 var authenticationMethods = |
| 394 'third_party,spake2_pair,spake2_hmac,spake2_plain'; | 403 'third_party,spake2_pair,spake2_hmac,spake2_plain'; |
| 395 this.clientSession_ = new remoting.ClientSession( | 404 this.clientSession_ = new remoting.ClientSession( |
| 396 this.hostDisplayName_, this.passPhrase_, this.fetchPin_, | 405 this.passPhrase_, this.fetchPin_, this.fetchThirdPartyToken_, |
| 397 this.fetchThirdPartyToken_, authenticationMethods, this.hostId_, | 406 authenticationMethods, this.hostId_, this.hostJid_, this.hostPublicKey_, |
| 398 this.hostJid_, this.hostPublicKey_, this.connectionMode_, | 407 this.connectionMode_, this.clientPairingId_, this.clientPairedSecret_); |
| 399 this.clientPairingId_, this.clientPairedSecret_); | |
| 400 this.clientSession_.logHostOfflineErrors(!this.refreshHostJidIfOffline_); | 408 this.clientSession_.logHostOfflineErrors(!this.refreshHostJidIfOffline_); |
| 401 this.clientSession_.addEventListener( | 409 this.clientSession_.addEventListener( |
| 402 remoting.ClientSession.Events.stateChanged, | 410 remoting.ClientSession.Events.stateChanged, |
| 403 this.bound_.onStateChange); | 411 this.bound_.onStateChange); |
| 404 this.clientSession_.createPluginAndConnect(this.pluginParent_, | 412 this.clientSession_.createPluginAndConnect(this.pluginParent_, |
| 405 this.onExtensionMessage_); | 413 this.onExtensionMessage_); |
| 406 }; | 414 }; |
| 407 | 415 |
| 408 /** | 416 /** |
| 409 * Handle a change in the state of the client session prior to successful | 417 * Handle a change in the state of the client session prior to successful |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 * Normalize the access code entered by the user. | 526 * Normalize the access code entered by the user. |
| 519 * | 527 * |
| 520 * @param {string} accessCode The access code, as entered by the user. | 528 * @param {string} accessCode The access code, as entered by the user. |
| 521 * @return {string} The normalized form of the code (whitespace removed). | 529 * @return {string} The normalized form of the code (whitespace removed). |
| 522 */ | 530 */ |
| 523 remoting.SessionConnector.prototype.normalizeAccessCode_ = | 531 remoting.SessionConnector.prototype.normalizeAccessCode_ = |
| 524 function(accessCode) { | 532 function(accessCode) { |
| 525 // Trim whitespace. | 533 // Trim whitespace. |
| 526 return accessCode.replace(/\s/g, ''); | 534 return accessCode.replace(/\s/g, ''); |
| 527 }; | 535 }; |
| OLD | NEW |