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 host daemon via Native Messaging. | 7 * Class to communicate with the host daemon 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 */ | 17 */ |
18 remoting.HostDaemonFacade = function() { | 18 remoting.HostDaemonFacade = function() { |
19 /** | 19 /** @private {number} */ |
20 * @type {number} | |
21 * @private | |
22 */ | |
23 this.nextId_ = 0; | 20 this.nextId_ = 0; |
24 | 21 |
25 /** | 22 /** @private {Object<number, remoting.HostDaemonFacade.PendingReply>} */ |
26 * @type {Object<number, remoting.HostDaemonFacade.PendingReply>} | |
27 * @private | |
28 */ | |
29 this.pendingReplies_ = {}; | 23 this.pendingReplies_ = {}; |
30 | 24 |
31 /** @type {?chrome.runtime.Port} @private */ | 25 /** @private {?chrome.runtime.Port} */ |
32 this.port_ = null; | 26 this.port_ = null; |
33 | 27 |
34 /** @type {string} @private */ | 28 /** @private {string} */ |
35 this.version_ = ''; | 29 this.version_ = ''; |
36 | 30 |
37 /** @type {Array<remoting.HostController.Feature>} @private */ | 31 /** @private {Array<remoting.HostController.Feature>} */ |
38 this.supportedFeatures_ = []; | 32 this.supportedFeatures_ = []; |
39 | 33 |
40 /** @type {Array<function(boolean):void>} @private */ | 34 /** @private {Array<function(boolean):void>} */ |
41 this.afterInitializationTasks_ = []; | 35 this.afterInitializationTasks_ = []; |
42 | 36 |
43 /** | 37 /** |
44 * A promise that fulfills when the daemon finishes initializing. | 38 * A promise that fulfills when the daemon finishes initializing. |
45 * It will be set to null when the promise fulfills. | 39 * It will be set to null when the promise fulfills. |
46 * @type {Promise} | 40 * @private {Promise} |
47 * @private | |
48 */ | 41 */ |
49 this.initializingPromise_ = null; | 42 this.initializingPromise_ = null; |
50 | 43 |
51 /** @type {remoting.Error} @private */ | 44 /** @private {remoting.Error} */ |
52 this.error_ = remoting.Error.NONE; | 45 this.error_ = remoting.Error.NONE; |
53 | 46 |
54 /** @private */ | 47 /** @private */ |
55 this.onIncomingMessageCallback_ = this.onIncomingMessage_.bind(this); | 48 this.onIncomingMessageCallback_ = this.onIncomingMessage_.bind(this); |
56 | 49 |
57 /** @private */ | 50 /** @private */ |
58 this.onDisconnectCallback_ = this.onDisconnect_.bind(this); | 51 this.onDisconnectCallback_ = this.onDisconnect_.bind(this); |
59 | 52 |
60 this.initialize_(); | 53 this.initialize_(); |
61 }; | 54 }; |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 * @param {function(remoting.Error):void} onError Callback to call on error. | 551 * @param {function(remoting.Error):void} onError Callback to call on error. |
559 * @return {void} Nothing. | 552 * @return {void} Nothing. |
560 */ | 553 */ |
561 remoting.HostDaemonFacade.prototype.getCredentialsFromAuthCode = | 554 remoting.HostDaemonFacade.prototype.getCredentialsFromAuthCode = |
562 function(authorizationCode, onDone, onError) { | 555 function(authorizationCode, onDone, onError) { |
563 this.postMessage_({ | 556 this.postMessage_({ |
564 type: 'getCredentialsFromAuthCode', | 557 type: 'getCredentialsFromAuthCode', |
565 authorizationCode: authorizationCode | 558 authorizationCode: authorizationCode |
566 }, onDone, onError); | 559 }, onDone, onError); |
567 }; | 560 }; |
OLD | NEW |