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 22 matching lines...) Expand all Loading... |
33 | 33 |
34 /** @private {string} */ | 34 /** @private {string} */ |
35 this.clientId_ = ''; | 35 this.clientId_ = ''; |
36 | 36 |
37 /** @private {boolean} */ | 37 /** @private {boolean} */ |
38 this.initialized_ = false; | 38 this.initialized_ = false; |
39 | 39 |
40 /** @private {base.Disposables} */ | 40 /** @private {base.Disposables} */ |
41 this.eventHooks_ = null; | 41 this.eventHooks_ = null; |
42 | 42 |
43 /** | 43 /** @private {?function():void} */ |
44 * @type {?function():void} | |
45 * @private | |
46 */ | |
47 this.onInitialized_ = function() {}; | 44 this.onInitialized_ = function() {}; |
48 | 45 |
49 /** | 46 /** |
50 * Called if Native Messaging host has failed to start. | 47 * Called if Native Messaging host has failed to start. |
51 * @private | 48 * @private |
52 * */ | 49 * */ |
53 this.onInitializationFailed_ = function() {}; | 50 this.onInitializationFailed_ = function() {}; |
54 | 51 |
55 /** | 52 /** |
56 * Called if the It2Me Native Messaging host sends a malformed message: | 53 * Called if the It2Me Native Messaging host sends a malformed message: |
57 * missing required attributes, attributes with incorrect types, etc. | 54 * missing required attributes, attributes with incorrect types, etc. |
58 * @type {?function(remoting.Error):void} | 55 * @private {?function(remoting.Error):void} |
59 * @private | |
60 */ | 56 */ |
61 this.onError_ = function(error) {}; | 57 this.onError_ = function(error) {}; |
62 | 58 |
63 /** | 59 /** @private {?function(remoting.HostSession.State):void} */ |
64 * @type {?function(remoting.HostSession.State):void} | |
65 * @private | |
66 */ | |
67 this.onStateChanged_ = function() {}; | 60 this.onStateChanged_ = function() {}; |
68 | 61 |
69 /** | 62 /** @private {?function(boolean):void} */ |
70 * @type {?function(boolean):void} | |
71 * @private | |
72 */ | |
73 this.onNatPolicyChanged_ = function() {}; | 63 this.onNatPolicyChanged_ = function() {}; |
74 }; | 64 }; |
75 | 65 |
76 remoting.It2MeHostFacade.prototype.dispose = function() { | 66 remoting.It2MeHostFacade.prototype.dispose = function() { |
77 base.dispose(this.eventHooks_); | 67 base.dispose(this.eventHooks_); |
78 this.eventHooks_ = null; | 68 this.eventHooks_ = null; |
79 if (this.port_) { | 69 if (this.port_) { |
80 this.port_.disconnect(); | 70 this.port_.disconnect(); |
81 this.port_ = null; | 71 this.port_ = null; |
82 } | 72 } |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 chrome.runtime.lastError.message); | 314 chrome.runtime.lastError.message); |
325 this.onInitializationFailed_(); | 315 this.onInitializationFailed_(); |
326 } else { | 316 } else { |
327 console.error('Native Messaging port disconnected.'); | 317 console.error('Native Messaging port disconnected.'); |
328 this.port_ = null; | 318 this.port_ = null; |
329 this.onError_(remoting.Error.UNEXPECTED); | 319 this.onError_(remoting.Error.UNEXPECTED); |
330 } | 320 } |
331 }; | 321 }; |
332 | 322 |
333 })(); | 323 })(); |
OLD | NEW |