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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 * Continue an IT2Me connection once the host JID has been looked up. | 408 * Continue an IT2Me connection once the host JID has been looked up. |
409 * | 409 * |
410 * @param {XMLHttpRequest} xhr The server response to the support-hosts query. | 410 * @param {XMLHttpRequest} xhr The server response to the support-hosts query. |
411 * @return {void} Nothing. | 411 * @return {void} Nothing. |
412 * @private | 412 * @private |
413 */ | 413 */ |
414 remoting.SessionConnectorImpl.prototype.onIT2MeHostInfo_ = function(xhr) { | 414 remoting.SessionConnectorImpl.prototype.onIT2MeHostInfo_ = function(xhr) { |
415 this.pendingXhr_ = null; | 415 this.pendingXhr_ = null; |
416 if (xhr.status == 200) { | 416 if (xhr.status == 200) { |
417 var host = /** @type {{data: {jabberId: string, publicKey: string}}} */ | 417 var host = /** @type {{data: {jabberId: string, publicKey: string}}} */ |
418 jsonParseSafe(xhr.responseText); | 418 base.jsonParseSafe(xhr.responseText); |
419 if (host && host.data && host.data.jabberId && host.data.publicKey) { | 419 if (host && host.data && host.data.jabberId && host.data.publicKey) { |
420 this.hostJid_ = host.data.jabberId; | 420 this.hostJid_ = host.data.jabberId; |
421 this.hostPublicKey_ = host.data.publicKey; | 421 this.hostPublicKey_ = host.data.publicKey; |
422 this.hostDisplayName_ = this.hostJid_.split('/')[0]; | 422 this.hostDisplayName_ = this.hostJid_.split('/')[0]; |
423 this.connectSignaling_(); | 423 this.connectSignaling_(); |
424 return; | 424 return; |
425 } else { | 425 } else { |
426 console.error('Invalid "support-hosts" response from server.'); | 426 console.error('Invalid "support-hosts" response from server.'); |
427 } | 427 } |
428 } else { | 428 } else { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 * @param {function(remoting.Error):void} onError Callback on error. | 595 * @param {function(remoting.Error):void} onError Callback on error. |
596 * @param {function(string, string):boolean} onExtensionMessage The handler for | 596 * @param {function(string, string):boolean} onExtensionMessage The handler for |
597 * protocol extension messages. Returns true if a message is recognized; | 597 * protocol extension messages. Returns true if a message is recognized; |
598 * false otherwise. | 598 * false otherwise. |
599 */ | 599 */ |
600 remoting.DefaultSessionConnectorFactory.prototype.createConnector = | 600 remoting.DefaultSessionConnectorFactory.prototype.createConnector = |
601 function(clientContainer, onConnected, onError, onExtensionMessage) { | 601 function(clientContainer, onConnected, onError, onExtensionMessage) { |
602 return new remoting.SessionConnectorImpl( | 602 return new remoting.SessionConnectorImpl( |
603 clientContainer, onConnected, onError, onExtensionMessage); | 603 clientContainer, onConnected, onError, onExtensionMessage); |
604 }; | 604 }; |
OLD | NEW |