| 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 16 matching lines...) Expand all Loading... |
| 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, |
| 35 requiredCapabilities, | 35 requiredCapabilities, |
| 36 defaultRemapKeys) { | 36 defaultRemapKeys) { |
| 37 /** | 37 /** @private {HTMLElement} */ |
| 38 * @type {HTMLElement} | |
| 39 * @private | |
| 40 */ | |
| 41 this.clientContainer_ = clientContainer; | 38 this.clientContainer_ = clientContainer; |
| 42 | 39 |
| 43 /** | 40 /** @private {function(remoting.ClientSession):void} */ |
| 44 * @type {function(remoting.ClientSession):void} | |
| 45 * @private | |
| 46 */ | |
| 47 this.onConnected_ = onConnected; | 41 this.onConnected_ = onConnected; |
| 48 | 42 |
| 49 /** | 43 /** @private {function(remoting.Error):void} */ |
| 50 * @type {function(remoting.Error):void} | |
| 51 * @private | |
| 52 */ | |
| 53 this.onError_ = onError; | 44 this.onError_ = onError; |
| 54 | 45 |
| 55 /** | 46 /** @private {function(string, string):boolean} */ |
| 56 * @type {function(string, string):boolean} | |
| 57 * @private | |
| 58 */ | |
| 59 this.onExtensionMessage_ = onExtensionMessage; | 47 this.onExtensionMessage_ = onExtensionMessage; |
| 60 | 48 |
| 61 /** | 49 /** @private {function(remoting.Error):void} */ |
| 62 * @type {function(remoting.Error):void} | |
| 63 * @private | |
| 64 */ | |
| 65 this.onConnectionFailed_ = onConnectionFailed; | 50 this.onConnectionFailed_ = onConnectionFailed; |
| 66 | 51 |
| 67 /** | 52 /** @private {Array<string>} */ |
| 68 * @type {Array<string>} | |
| 69 * @private | |
| 70 */ | |
| 71 this.requiredCapabilities_ = requiredCapabilities; | 53 this.requiredCapabilities_ = requiredCapabilities; |
| 72 | 54 |
| 73 /** | 55 /** @private {string} */ |
| 74 * @type {string} | |
| 75 * @private | |
| 76 */ | |
| 77 this.defaultRemapKeys_ = defaultRemapKeys; | 56 this.defaultRemapKeys_ = defaultRemapKeys; |
| 78 | 57 |
| 79 /** | 58 /** @private {string} */ |
| 80 * @type {string} | |
| 81 * @private | |
| 82 */ | |
| 83 this.clientJid_ = ''; | 59 this.clientJid_ = ''; |
| 84 | 60 |
| 85 /** | 61 /** @private {remoting.DesktopConnectedView.Mode} */ |
| 86 * @type {remoting.DesktopConnectedView.Mode} | |
| 87 * @private | |
| 88 */ | |
| 89 this.connectionMode_ = remoting.DesktopConnectedView.Mode.ME2ME; | 62 this.connectionMode_ = remoting.DesktopConnectedView.Mode.ME2ME; |
| 90 | 63 |
| 91 /** | 64 /** @private {remoting.SignalStrategy} */ |
| 92 * @type {remoting.SignalStrategy} | |
| 93 * @private | |
| 94 */ | |
| 95 this.signalStrategy_ = null; | 65 this.signalStrategy_ = null; |
| 96 | 66 |
| 97 /** | 67 /** @private {remoting.SmartReconnector} */ |
| 98 * @type {remoting.SmartReconnector} | |
| 99 * @private | |
| 100 */ | |
| 101 this.reconnector_ = null; | 68 this.reconnector_ = null; |
| 102 | 69 |
| 103 /** | 70 /** @private */ |
| 104 * @private | |
| 105 */ | |
| 106 this.bound_ = { | 71 this.bound_ = { |
| 107 onStateChange : this.onStateChange_.bind(this) | 72 onStateChange : this.onStateChange_.bind(this) |
| 108 }; | 73 }; |
| 109 | 74 |
| 110 // Initialize/declare per-connection state. | 75 // Initialize/declare per-connection state. |
| 111 this.reset(); | 76 this.reset(); |
| 112 }; | 77 }; |
| 113 | 78 |
| 114 /** | 79 /** |
| 115 * Reset the per-connection state so that the object can be re-used for a | 80 * Reset the per-connection state so that the object can be re-used for a |
| 116 * second connection. Note the none of the shared WCS state is reset. | 81 * second connection. Note the none of the shared WCS state is reset. |
| 117 */ | 82 */ |
| 118 remoting.SessionConnectorImpl.prototype.reset = function() { | 83 remoting.SessionConnectorImpl.prototype.reset = function() { |
| 119 /** | 84 /** @private {remoting.Host} */ |
| 120 * @type {remoting.Host} | |
| 121 * @private | |
| 122 */ | |
| 123 this.host_ = null; | 85 this.host_ = null; |
| 124 | 86 |
| 125 /** | 87 /** @private {boolean} */ |
| 126 * @type {boolean} | |
| 127 * @private | |
| 128 */ | |
| 129 this.logHostOfflineErrors_ = false; | 88 this.logHostOfflineErrors_ = false; |
| 130 | 89 |
| 131 /** | 90 /** @private {remoting.ClientSession} */ |
| 132 * @type {remoting.ClientSession} | |
| 133 * @private | |
| 134 */ | |
| 135 this.clientSession_ = null; | 91 this.clientSession_ = null; |
| 136 | 92 |
| 137 /** | 93 /** @private {XMLHttpRequest} */ |
| 138 * @type {XMLHttpRequest} | |
| 139 * @private | |
| 140 */ | |
| 141 this.pendingXhr_ = null; | 94 this.pendingXhr_ = null; |
| 142 | 95 |
| 143 /** | 96 /** @type {remoting.CredentialsProvider} */ |
| 144 * @type {remoting.CredentialsProvider} | |
| 145 * @private | |
| 146 */ | |
| 147 this.credentialsProvider_ = null; | 97 this.credentialsProvider_ = null; |
| 148 }; | 98 }; |
| 149 | 99 |
| 150 /** | 100 /** |
| 151 * Initiate a Me2Me connection. | 101 * Initiate a Me2Me connection. |
| 152 * | 102 * |
| 153 * This doesn't report host-offline errors because the connection will | 103 * This doesn't report host-offline errors because the connection will |
| 154 * be retried and retryConnectMe2Me is responsible for reporting these errors. | 104 * be retried and retryConnectMe2Me is responsible for reporting these errors. |
| 155 * | 105 * |
| 156 * @param {remoting.Host} host The Me2Me host to which to connect. | 106 * @param {remoting.Host} host The Me2Me host to which to connect. |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 */ | 527 */ |
| 578 remoting.DefaultSessionConnectorFactory.prototype.createConnector = | 528 remoting.DefaultSessionConnectorFactory.prototype.createConnector = |
| 579 function(clientContainer, onConnected, onError, onExtensionMessage, | 529 function(clientContainer, onConnected, onError, onExtensionMessage, |
| 580 onConnectionFailed, requiredCapabilities, defaultRemapKeys) { | 530 onConnectionFailed, requiredCapabilities, defaultRemapKeys) { |
| 581 return new remoting.SessionConnectorImpl(clientContainer, onConnected, | 531 return new remoting.SessionConnectorImpl(clientContainer, onConnected, |
| 582 onError, onExtensionMessage, | 532 onError, onExtensionMessage, |
| 583 onConnectionFailed, | 533 onConnectionFailed, |
| 584 requiredCapabilities, | 534 requiredCapabilities, |
| 585 defaultRemapKeys); | 535 defaultRemapKeys); |
| 586 }; | 536 }; |
| OLD | NEW |