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

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

Issue 1010053002: [Webapp Refactor] Implements remoting.ConnectionInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer's feedback Created 5 years, 9 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
« no previous file with comments | « remoting/webapp/crd/js/session_connector.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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';
(...skipping 10 matching lines...) Expand all
21 21
22 /** 22 /**
23 * @type {remoting.DesktopConnectedView} The client session view object, set 23 * @type {remoting.DesktopConnectedView} The client session view object, set
24 * once the connector has invoked its onOk callback. 24 * once the connector has invoked its onOk callback.
25 * TODO(garykac): Have this owned by someone instead of being global. 25 * TODO(garykac): Have this owned by someone instead of being global.
26 */ 26 */
27 remoting.desktopConnectedView = null; 27 remoting.desktopConnectedView = null;
28 28
29 /** 29 /**
30 * @param {HTMLElement} clientContainer Container element for the client view. 30 * @param {HTMLElement} clientContainer Container element for the client view.
31 * @param {function(remoting.ClientSession):void} onConnected Callback on 31 * @param {function(remoting.ConnectionInfo):void} onConnected Callback on
32 * success. 32 * success.
33 * @param {function(!remoting.Error):void} onError Callback on error. 33 * @param {function(!remoting.Error):void} onError Callback on error.
34 * @param {function(string, string):boolean} appProtocolExtensionHandler The 34 * @param {function(string, string):boolean} appProtocolExtensionHandler The
35 * handler for the application's protocol extension messages. Returns true 35 * handler for the application's protocol extension messages. Returns true
36 * if a message is recognized; false otherwise. 36 * if a message is recognized; false otherwise.
37 * @param {function(!remoting.Error):void} onConnectionFailed Callback for when 37 * @param {function(!remoting.Error):void} onConnectionFailed Callback for when
38 * the connection fails. 38 * the connection fails.
39 * @param {Array<string>} requiredCapabilities Connector capabilities 39 * @param {Array<string>} requiredCapabilities Connector capabilities
40 * required by this application. 40 * required by this application.
41 * @param {string} defaultRemapKeys The default set of key mappings for the 41 * @param {string} defaultRemapKeys The default set of key mappings for the
42 * client session to use. 42 * client session to use.
43 * @constructor 43 * @constructor
44 * @implements {remoting.SessionConnector} 44 * @implements {remoting.SessionConnector}
45 */ 45 */
46 remoting.SessionConnectorImpl = function(clientContainer, onConnected, onError, 46 remoting.SessionConnectorImpl = function(clientContainer, onConnected, onError,
47 appProtocolExtensionHandler, 47 appProtocolExtensionHandler,
48 onConnectionFailed, 48 onConnectionFailed,
49 requiredCapabilities, 49 requiredCapabilities,
50 defaultRemapKeys) { 50 defaultRemapKeys) {
51 /** @private {HTMLElement} */ 51 /** @private {HTMLElement} */
52 this.clientContainer_ = clientContainer; 52 this.clientContainer_ = clientContainer;
53 53
54 /** @private {function(remoting.ClientSession):void} */ 54 /** @private {function(remoting.ConnectionInfo):void} */
55 this.onConnected_ = onConnected; 55 this.onConnected_ = onConnected;
56 56
57 /** @private {function(!remoting.Error):void} */ 57 /** @private {function(!remoting.Error):void} */
58 this.onError_ = onError; 58 this.onError_ = onError;
59 59
60 /** @private {function(string, string):boolean} */ 60 /** @private {function(string, string):boolean} */
61 this.appProtocolExtensionHandler_ = appProtocolExtensionHandler; 61 this.appProtocolExtensionHandler_ = appProtocolExtensionHandler;
62 62
63 /** @private {function(!remoting.Error):void} */ 63 /** @private {function(!remoting.Error):void} */
64 this.onConnectionFailed_ = onConnectionFailed; 64 this.onConnectionFailed_ = onConnectionFailed;
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 // or error conditions. 471 // or error conditions.
472 this.clientSession_.removeEventListener( 472 this.clientSession_.removeEventListener(
473 remoting.ClientSession.Events.stateChanged, 473 remoting.ClientSession.Events.stateChanged,
474 this.bound_.onStateChange); 474 this.bound_.onStateChange);
475 475
476 base.dispose(this.reconnector_); 476 base.dispose(this.reconnector_);
477 if (this.connectionMode_ != remoting.DesktopConnectedView.Mode.IT2ME) { 477 if (this.connectionMode_ != remoting.DesktopConnectedView.Mode.IT2ME) {
478 this.reconnector_ = 478 this.reconnector_ =
479 new remoting.SmartReconnector(this, this.clientSession_); 479 new remoting.SmartReconnector(this, this.clientSession_);
480 } 480 }
481 this.onConnected_(this.clientSession_); 481 var connectionInfo = new remoting.ConnectionInfo(
482 this.host_, this.credentialsProvider_, this.clientSession_,
483 this.plugin_, this.connectionMode_);
484 this.onConnected_(connectionInfo);
482 // Initialize any protocol extensions that may have been added by the app. 485 // Initialize any protocol extensions that may have been added by the app.
483 this.initProtocolExtensions_(); 486 this.initProtocolExtensions_();
484 break; 487 break;
485 488
486 case remoting.ClientSession.State.CREATED: 489 case remoting.ClientSession.State.CREATED:
487 console.log('Created plugin'); 490 console.log('Created plugin');
488 break; 491 break;
489 492
490 case remoting.ClientSession.State.CONNECTING: 493 case remoting.ClientSession.State.CONNECTING:
491 remoting.identity.getEmail().then( 494 remoting.identity.getEmail().then(
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 }; 530 };
528 531
529 /** 532 /**
530 * @constructor 533 * @constructor
531 * @implements {remoting.SessionConnectorFactory} 534 * @implements {remoting.SessionConnectorFactory}
532 */ 535 */
533 remoting.DefaultSessionConnectorFactory = function() {}; 536 remoting.DefaultSessionConnectorFactory = function() {};
534 537
535 /** 538 /**
536 * @param {HTMLElement} clientContainer Container element for the client view. 539 * @param {HTMLElement} clientContainer Container element for the client view.
537 * @param {function(remoting.ClientSession):void} onConnected Callback on 540 * @param {function(remoting.ConnectionInfo):void} onConnected Callback on
538 * success. 541 * success.
539 * @param {function(!remoting.Error):void} onError Callback on error. 542 * @param {function(!remoting.Error):void} onError Callback on error.
540 * @param {function(string, string):boolean} appProtocolExtensionHandler The 543 * @param {function(string, string):boolean} appProtocolExtensionHandler The
541 * handler for the application's protocol extension messages. Returns true 544 * handler for the application's protocol extension messages. Returns true
542 * if a message is recognized; false otherwise. 545 * if a message is recognized; false otherwise.
543 * @param {function(!remoting.Error):void} onConnectionFailed Callback for when 546 * @param {function(!remoting.Error):void} onConnectionFailed Callback for when
544 * the connection fails. 547 * the connection fails.
545 * @param {Array<string>} requiredCapabilities Connector capabilities 548 * @param {Array<string>} requiredCapabilities Connector capabilities
546 * required by this application. 549 * required by this application.
547 * @param {string} defaultRemapKeys The default set of key mappings to use 550 * @param {string} defaultRemapKeys The default set of key mappings to use
548 * in the client session. 551 * in the client session.
549 * @return {remoting.SessionConnector} 552 * @return {remoting.SessionConnector}
550 */ 553 */
551 remoting.DefaultSessionConnectorFactory.prototype.createConnector = 554 remoting.DefaultSessionConnectorFactory.prototype.createConnector =
552 function(clientContainer, onConnected, onError, 555 function(clientContainer, onConnected, onError,
553 appProtocolExtensionHandler, 556 appProtocolExtensionHandler,
554 onConnectionFailed, requiredCapabilities, defaultRemapKeys) { 557 onConnectionFailed, requiredCapabilities, defaultRemapKeys) {
555 return new remoting.SessionConnectorImpl(clientContainer, onConnected, 558 return new remoting.SessionConnectorImpl(clientContainer, onConnected,
556 onError, 559 onError,
557 appProtocolExtensionHandler, 560 appProtocolExtensionHandler,
558 onConnectionFailed, 561 onConnectionFailed,
559 requiredCapabilities, 562 requiredCapabilities,
560 defaultRemapKeys); 563 defaultRemapKeys);
561 }; 564 };
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/session_connector.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698