| 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 '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 * @constructor | 16 * @constructor |
| 17 * @param {function(remoting.HostSession.State):void} onStateChanged Callback to | |
| 18 * invoke when the host state changes. | |
| 19 * @param {function(boolean):void} onNatPolicyChanged Callback to invoke when | |
| 20 * the nat traversal policy changes. | |
| 21 */ | 17 */ |
| 22 remoting.HostIt2MeNativeMessaging = function() { | 18 remoting.HostIt2MeNativeMessaging = function() { |
| 23 /** | 19 /** |
| 24 * @type {number} | 20 * @type {number} |
| 25 * @private | 21 * @private |
| 26 */ | 22 */ |
| 27 this.nextId_ = 0; | 23 this.nextId_ = 0; |
| 28 | 24 |
| 29 /** | 25 /** |
| 30 * @type {?chrome.extension.Port} | 26 * @type {?chrome.extension.Port} |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 138 |
| 143 /** | 139 /** |
| 144 * Handler for incoming Native Messages. | 140 * Handler for incoming Native Messages. |
| 145 * | 141 * |
| 146 * @param {Object} message The received message. | 142 * @param {Object} message The received message. |
| 147 * @return {void} | 143 * @return {void} |
| 148 * @private | 144 * @private |
| 149 */ | 145 */ |
| 150 remoting.HostIt2MeNativeMessaging.prototype.onIncomingMessage_ = | 146 remoting.HostIt2MeNativeMessaging.prototype.onIncomingMessage_ = |
| 151 function(message) { | 147 function(message) { |
| 148 /** @type {string} */ |
| 152 var type = message['type']; | 149 var type = message['type']; |
| 153 if (!checkType_('type', type, 'string')) { | 150 if (!checkType_('type', type, 'string')) { |
| 154 this.onError_(); | 151 this.onError_(); |
| 155 return; | 152 return; |
| 156 } | 153 } |
| 157 | 154 |
| 158 switch (type) { | 155 switch (type) { |
| 159 case 'helloResponse': | 156 case 'helloResponse': |
| 160 /** @type {string} */ | 157 /** @type {string} */ |
| 161 var version = message['version']; | 158 var version = message['version']; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 remoting.HostIt2MeNativeMessaging.prototype.getAccessCodeLifetime = function() { | 337 remoting.HostIt2MeNativeMessaging.prototype.getAccessCodeLifetime = function() { |
| 341 return this.accessCodeLifetime_ | 338 return this.accessCodeLifetime_ |
| 342 }; | 339 }; |
| 343 | 340 |
| 344 /** | 341 /** |
| 345 * @return {string} | 342 * @return {string} |
| 346 */ | 343 */ |
| 347 remoting.HostIt2MeNativeMessaging.prototype.getClient = function() { | 344 remoting.HostIt2MeNativeMessaging.prototype.getClient = function() { |
| 348 return this.clientId_; | 345 return this.clientId_; |
| 349 }; | 346 }; |
| OLD | NEW |