| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * Class to communicate with the It2me Host component via Native Messaging. | 7 * Class to communicate with the It2me Host component via Native Messaging. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 /** @suppress {duplicate} */ | 10 /** @suppress {duplicate} */ |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 /** | 49 /** |
| 50 * Called if Native Messaging host has failed to start. | 50 * Called if Native Messaging host has failed to start. |
| 51 * @private | 51 * @private |
| 52 * */ | 52 * */ |
| 53 this.onInitializationFailed_ = function() {}; | 53 this.onInitializationFailed_ = function() {}; |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * Called if the It2Me Native Messaging host sends a malformed message: | 56 * Called if the It2Me Native Messaging host sends a malformed message: |
| 57 * missing required attributes, attributes with incorrect types, etc. | 57 * missing required attributes, attributes with incorrect types, etc. |
| 58 * @type {?function(remoting.Error):void} | 58 * @type {?function(!remoting.Error):void} |
| 59 * @private | 59 * @private |
| 60 */ | 60 */ |
| 61 this.onError_ = function(error) {}; | 61 this.onError_ = function(error) {}; |
| 62 | 62 |
| 63 /** | 63 /** |
| 64 * @type {?function(remoting.HostSession.State):void} | 64 * @type {?function(remoting.HostSession.State):void} |
| 65 * @private | 65 * @private |
| 66 */ | 66 */ |
| 67 this.onStateChanged_ = function() {}; | 67 this.onStateChanged_ = function() {}; |
| 68 | 68 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 * @param {function(boolean):void} onNatPolicyChanged Callback to invoke when | 124 * @param {function(boolean):void} onNatPolicyChanged Callback to invoke when |
| 125 * the nat traversal policy changes. | 125 * the nat traversal policy changes. |
| 126 * @param {function(string):void} logDebugInfo Callback allowing the plugin | 126 * @param {function(string):void} logDebugInfo Callback allowing the plugin |
| 127 * to log messages to the debug log. | 127 * to log messages to the debug log. |
| 128 * @param {string} xmppServerAddress XMPP server host name (or IP address) and | 128 * @param {string} xmppServerAddress XMPP server host name (or IP address) and |
| 129 * port. | 129 * port. |
| 130 * @param {boolean} xmppServerUseTls Whether to use TLS on connections to the | 130 * @param {boolean} xmppServerUseTls Whether to use TLS on connections to the |
| 131 * XMPP server | 131 * XMPP server |
| 132 * @param {string} directoryBotJid XMPP JID for the remoting directory server | 132 * @param {string} directoryBotJid XMPP JID for the remoting directory server |
| 133 * bot. | 133 * bot. |
| 134 * @param {function(remoting.Error):void} onError Callback to invoke in case of | 134 * @param {function(!remoting.Error):void} onError Callback to invoke in case of |
| 135 * an error. | 135 * an error. |
| 136 * @return {void} | 136 * @return {void} |
| 137 */ | 137 */ |
| 138 remoting.It2MeHostFacade.prototype.connect = | 138 remoting.It2MeHostFacade.prototype.connect = |
| 139 function(email, authServiceWithToken, onStateChanged, onNatPolicyChanged, | 139 function(email, authServiceWithToken, onStateChanged, onNatPolicyChanged, |
| 140 logDebugInfo, xmppServerAddress, xmppServerUseTls, directoryBotJid, | 140 logDebugInfo, xmppServerAddress, xmppServerUseTls, directoryBotJid, |
| 141 onError) { | 141 onError) { |
| 142 if (!this.port_) { | 142 if (!this.port_) { |
| 143 console.error( | 143 console.error( |
| 144 'remoting.It2MeHostFacade.connect() without initialization.'); | 144 'remoting.It2MeHostFacade.connect() without initialization.'); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 chrome.runtime.lastError.message); | 324 chrome.runtime.lastError.message); |
| 325 this.onInitializationFailed_(); | 325 this.onInitializationFailed_(); |
| 326 } else { | 326 } else { |
| 327 console.error('Native Messaging port disconnected.'); | 327 console.error('Native Messaging port disconnected.'); |
| 328 this.port_ = null; | 328 this.port_ = null; |
| 329 this.onError_(remoting.Error.UNEXPECTED); | 329 this.onError_(remoting.Error.UNEXPECTED); |
| 330 } | 330 } |
| 331 }; | 331 }; |
| 332 | 332 |
| 333 })(); | 333 })(); |
| OLD | NEW |