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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 /** | 461 /** |
462 * Continue an IT2Me connection once an access token has been obtained. | 462 * Continue an IT2Me connection once an access token has been obtained. |
463 * | 463 * |
464 * @param {string} token An OAuth2 access token. | 464 * @param {string} token An OAuth2 access token. |
465 * @return {void} Nothing. | 465 * @return {void} Nothing. |
466 * @private | 466 * @private |
467 */ | 467 */ |
468 remoting.SessionConnectorImpl.prototype.connectIT2MeWithToken_ = | 468 remoting.SessionConnectorImpl.prototype.connectIT2MeWithToken_ = |
469 function(token) { | 469 function(token) { |
470 // Resolve the host id to get the host JID. | 470 // Resolve the host id to get the host JID. |
471 this.pendingXhr_ = remoting.xhr.get( | 471 this.pendingXhr_ = remoting.xhr.start({ |
472 remoting.settings.DIRECTORY_API_BASE_URL + '/support-hosts/' + | 472 method: 'GET', |
473 encodeURIComponent(this.hostId_), | 473 url: remoting.settings.DIRECTORY_API_BASE_URL + '/support-hosts/' + |
474 this.onIT2MeHostInfo_.bind(this), | 474 encodeURIComponent(this.hostId_), |
475 '', | 475 onDone: this.onIT2MeHostInfo_.bind(this), |
476 { 'Authorization': 'OAuth ' + token }); | 476 oauthToken: token |
| 477 }); |
477 }; | 478 }; |
478 | 479 |
479 /** | 480 /** |
480 * Continue an IT2Me connection once the host JID has been looked up. | 481 * Continue an IT2Me connection once the host JID has been looked up. |
481 * | 482 * |
482 * @param {XMLHttpRequest} xhr The server response to the support-hosts query. | 483 * @param {XMLHttpRequest} xhr The server response to the support-hosts query. |
483 * @return {void} Nothing. | 484 * @return {void} Nothing. |
484 * @private | 485 * @private |
485 */ | 486 */ |
486 remoting.SessionConnectorImpl.prototype.onIT2MeHostInfo_ = function(xhr) { | 487 remoting.SessionConnectorImpl.prototype.onIT2MeHostInfo_ = function(xhr) { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 */ | 656 */ |
656 remoting.DefaultSessionConnectorFactory.prototype.createConnector = | 657 remoting.DefaultSessionConnectorFactory.prototype.createConnector = |
657 function(clientContainer, onConnected, onError, onExtensionMessage, | 658 function(clientContainer, onConnected, onError, onExtensionMessage, |
658 onConnectionFailed, requiredCapabilities, defaultRemapKeys) { | 659 onConnectionFailed, requiredCapabilities, defaultRemapKeys) { |
659 return new remoting.SessionConnectorImpl(clientContainer, onConnected, | 660 return new remoting.SessionConnectorImpl(clientContainer, onConnected, |
660 onError, onExtensionMessage, | 661 onError, onExtensionMessage, |
661 onConnectionFailed, | 662 onConnectionFailed, |
662 requiredCapabilities, | 663 requiredCapabilities, |
663 defaultRemapKeys); | 664 defaultRemapKeys); |
664 }; | 665 }; |
OLD | NEW |