Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(882)

Side by Side Diff: remoting/webapp/crd/js/session_connector_impl.js

Issue 803653004: Update Chromoting to use /third_party/closure_compiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused types Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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';
11 11
12 /** @suppress {duplicate} */ 12 /** @suppress {duplicate} */
13 var remoting = remoting || {}; 13 var remoting = remoting || {};
14 14
15 /** 15 /**
16 * @param {HTMLElement} clientContainer Container element for the client view. 16 * @param {HTMLElement} clientContainer Container element for the client view.
17 * @param {function(remoting.ClientSession):void} onConnected Callback on 17 * @param {function(remoting.ClientSession):void} onConnected Callback on
18 * success. 18 * success.
19 * @param {function(remoting.Error):void} onError Callback on error. 19 * @param {function(remoting.Error):void} onError Callback on error.
20 * @param {function(string, string):boolean} onExtensionMessage The handler for 20 * @param {function(string, string):boolean} onExtensionMessage The handler for
21 * protocol extension messages. Returns true if a message is recognized; 21 * protocol extension messages. Returns true if a message is recognized;
22 * false otherwise. 22 * false otherwise.
23 * @param {function(string):void} onConnectionFailed Callback for when the 23 * @param {function(remoting.Error):void} onConnectionFailed Callback for when
24 * connection fails. 24 * the connection fails.
25 * @param {Array.<string>} requiredCapabilities Connector capabilities 25 * @param {Array.<string>} requiredCapabilities Connector capabilities
26 * required by this application. 26 * required by this application.
27 * @param {string} defaultRemapKeys The default set of key mappings for the 27 * @param {string} defaultRemapKeys The default set of key mappings for the
28 * client session to use. 28 * client session to use.
29 * @constructor 29 * @constructor
30 * @implements {remoting.SessionConnector} 30 * @implements {remoting.SessionConnector}
31 */ 31 */
32 remoting.SessionConnectorImpl = function(clientContainer, onConnected, onError, 32 remoting.SessionConnectorImpl = function(clientContainer, onConnected, onError,
33 onExtensionMessage, 33 onExtensionMessage,
34 onConnectionFailed, 34 onConnectionFailed,
(...skipping 17 matching lines...) Expand all
52 */ 52 */
53 this.onError_ = onError; 53 this.onError_ = onError;
54 54
55 /** 55 /**
56 * @type {function(string, string):boolean} 56 * @type {function(string, string):boolean}
57 * @private 57 * @private
58 */ 58 */
59 this.onExtensionMessage_ = onExtensionMessage; 59 this.onExtensionMessage_ = onExtensionMessage;
60 60
61 /** 61 /**
62 * @type {function(string):void} 62 * @type {function(remoting.Error):void}
63 * @private 63 * @private
64 */ 64 */
65 this.onConnectionFailed_ = onConnectionFailed; 65 this.onConnectionFailed_ = onConnectionFailed;
66 66
67 /** 67 /**
68 * @type {Array.<string>} 68 * @type {Array.<string>}
69 * @private 69 * @private
70 */ 70 */
71 this.requiredCapabilities_ = requiredCapabilities; 71 this.requiredCapabilities_ = requiredCapabilities;
72 72
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 * Continue an IT2Me connection once the host JID has been looked up. 479 * Continue an IT2Me connection once the host JID has been looked up.
480 * 480 *
481 * @param {XMLHttpRequest} xhr The server response to the support-hosts query. 481 * @param {XMLHttpRequest} xhr The server response to the support-hosts query.
482 * @return {void} Nothing. 482 * @return {void} Nothing.
483 * @private 483 * @private
484 */ 484 */
485 remoting.SessionConnectorImpl.prototype.onIT2MeHostInfo_ = function(xhr) { 485 remoting.SessionConnectorImpl.prototype.onIT2MeHostInfo_ = function(xhr) {
486 this.pendingXhr_ = null; 486 this.pendingXhr_ = null;
487 if (xhr.status == 200) { 487 if (xhr.status == 200) {
488 var host = /** @type {{data: {jabberId: string, publicKey: string}}} */ 488 var host = /** @type {{data: {jabberId: string, publicKey: string}}} */
489 base.jsonParseSafe(xhr.responseText); 489 (base.jsonParseSafe(xhr.responseText));
490 if (host && host.data && host.data.jabberId && host.data.publicKey) { 490 if (host && host.data && host.data.jabberId && host.data.publicKey) {
491 this.hostJid_ = host.data.jabberId; 491 this.hostJid_ = host.data.jabberId;
492 this.hostPublicKey_ = host.data.publicKey; 492 this.hostPublicKey_ = host.data.publicKey;
493 this.hostDisplayName_ = this.hostJid_.split('/')[0]; 493 this.hostDisplayName_ = this.hostJid_.split('/')[0];
494 this.connectSignaling_(); 494 this.connectSignaling_();
495 return; 495 return;
496 } else { 496 } else {
497 console.error('Invalid "support-hosts" response from server.'); 497 console.error('Invalid "support-hosts" response from server.');
498 } 498 }
499 } else { 499 } else {
(...skipping 28 matching lines...) Expand all
528 this.clientSession_.createPluginAndConnect(this.onExtensionMessage_, 528 this.clientSession_.createPluginAndConnect(this.onExtensionMessage_,
529 this.requiredCapabilities_); 529 this.requiredCapabilities_);
530 }; 530 };
531 531
532 /** 532 /**
533 * Handle a change in the state of the client session prior to successful 533 * Handle a change in the state of the client session prior to successful
534 * connection (after connection, this class no longer handles state change 534 * connection (after connection, this class no longer handles state change
535 * events). Errors that occur while connecting either trigger a reconnect 535 * events). Errors that occur while connecting either trigger a reconnect
536 * or notify the onError handler. 536 * or notify the onError handler.
537 * 537 *
538 * @param {remoting.ClientSession.StateEvent} event 538 * @param {remoting.ClientSession.StateEvent=} event
539 * @return {void} Nothing. 539 * @return {void} Nothing.
540 * @private 540 * @private
541 */ 541 */
542 remoting.SessionConnectorImpl.prototype.onStateChange_ = function(event) { 542 remoting.SessionConnectorImpl.prototype.onStateChange_ = function(event) {
543 switch (event.current) { 543 switch (event.current) {
544 case remoting.ClientSession.State.CONNECTED: 544 case remoting.ClientSession.State.CONNECTED:
545 // When the connection succeeds, deregister for state-change callbacks 545 // When the connection succeeds, deregister for state-change callbacks
546 // and pass the session to the onConnected callback. It is expected that 546 // and pass the session to the onConnected callback. It is expected that
547 // it will register a new state-change callback to handle disconnect 547 // it will register a new state-change callback to handle disconnect
548 // or error conditions. 548 // or error conditions.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 }; 637 };
638 638
639 /** 639 /**
640 * @param {HTMLElement} clientContainer Container element for the client view. 640 * @param {HTMLElement} clientContainer Container element for the client view.
641 * @param {function(remoting.ClientSession):void} onConnected Callback on 641 * @param {function(remoting.ClientSession):void} onConnected Callback on
642 * success. 642 * success.
643 * @param {function(remoting.Error):void} onError Callback on error. 643 * @param {function(remoting.Error):void} onError Callback on error.
644 * @param {function(string, string):boolean} onExtensionMessage The handler for 644 * @param {function(string, string):boolean} onExtensionMessage The handler for
645 * protocol extension messages. Returns true if a message is recognized; 645 * protocol extension messages. Returns true if a message is recognized;
646 * false otherwise. 646 * false otherwise.
647 * @param {function(string):void} onConnectionFailed Callback for when the 647 * @param {function(remoting.Error):void} onConnectionFailed Callback for when
648 * connection fails. 648 * the connection fails.
649 * @param {Array.<string>} requiredCapabilities Connector capabilities 649 * @param {Array.<string>} requiredCapabilities Connector capabilities
650 * required by this application. 650 * required by this application.
651 * @param {string} defaultRemapKeys The default set of key mappings to use 651 * @param {string} defaultRemapKeys The default set of key mappings to use
652 * in the client session. 652 * in the client session.
653 * @return {remoting.SessionConnector} 653 * @return {remoting.SessionConnector}
654 */ 654 */
655 remoting.DefaultSessionConnectorFactory.prototype.createConnector = 655 remoting.DefaultSessionConnectorFactory.prototype.createConnector =
656 function(clientContainer, onConnected, onError, onExtensionMessage, 656 function(clientContainer, onConnected, onError, onExtensionMessage,
657 onConnectionFailed, requiredCapabilities, defaultRemapKeys) { 657 onConnectionFailed, requiredCapabilities, defaultRemapKeys) {
658 return new remoting.SessionConnectorImpl(clientContainer, onConnected, 658 return new remoting.SessionConnectorImpl(clientContainer, onConnected,
659 onError, onExtensionMessage, 659 onError, onExtensionMessage,
660 onConnectionFailed, 660 onConnectionFailed,
661 requiredCapabilities, 661 requiredCapabilities,
662 defaultRemapKeys); 662 defaultRemapKeys);
663 }; 663 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698