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 /** |
20 * @type {number} | 20 * @type {number} |
21 * @private | 21 * @private |
22 */ | 22 */ |
23 this.nextId_ = 0; | 23 this.nextId_ = 0; |
24 | 24 |
25 /** | 25 /** |
26 * @type {Object.<number, remoting.HostDaemonFacade.PendingReply>} | 26 * @type {Object<number, remoting.HostDaemonFacade.PendingReply>} |
27 * @private | 27 * @private |
28 */ | 28 */ |
29 this.pendingReplies_ = {}; | 29 this.pendingReplies_ = {}; |
30 | 30 |
31 /** @type {?chrome.runtime.Port} @private */ | 31 /** @type {?chrome.runtime.Port} @private */ |
32 this.port_ = null; | 32 this.port_ = null; |
33 | 33 |
34 /** @type {string} @private */ | 34 /** @type {string} @private */ |
35 this.version_ = ''; | 35 this.version_ = ''; |
36 | 36 |
37 /** @type {Array.<remoting.HostController.Feature>} @private */ | 37 /** @type {Array<remoting.HostController.Feature>} @private */ |
38 this.supportedFeatures_ = []; | 38 this.supportedFeatures_ = []; |
39 | 39 |
40 /** @type {Array.<function(boolean):void>} @private */ | 40 /** @type {Array<function(boolean):void>} @private */ |
41 this.afterInitializationTasks_ = []; | 41 this.afterInitializationTasks_ = []; |
42 | 42 |
43 /** | 43 /** |
44 * A promise that fulfills when the daemon finishes initializing. | 44 * A promise that fulfills when the daemon finishes initializing. |
45 * It will be set to null when the promise fulfills. | 45 * It will be set to null when the promise fulfills. |
46 * @type {Promise} | 46 * @type {Promise} |
47 * @private | 47 * @private |
48 */ | 48 */ |
49 this.initializingPromise_ = null; | 49 this.initializingPromise_ = null; |
50 | 50 |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 * @return {void} Nothing. | 497 * @return {void} Nothing. |
498 */ | 498 */ |
499 remoting.HostDaemonFacade.prototype.getDaemonState = | 499 remoting.HostDaemonFacade.prototype.getDaemonState = |
500 function(onDone, onError) { | 500 function(onDone, onError) { |
501 this.postMessage_({type: 'getDaemonState'}, onDone, onError); | 501 this.postMessage_({type: 'getDaemonState'}, onDone, onError); |
502 } | 502 } |
503 | 503 |
504 /** | 504 /** |
505 * Retrieves the list of paired clients. | 505 * Retrieves the list of paired clients. |
506 * | 506 * |
507 * @param {function(Array.<remoting.PairedClient>):void} onDone Callback to | 507 * @param {function(Array<remoting.PairedClient>):void} onDone Callback to |
508 * return result. | 508 * return result. |
509 * @param {function(remoting.Error):void} onError Callback to call on error. | 509 * @param {function(remoting.Error):void} onError Callback to call on error. |
510 */ | 510 */ |
511 remoting.HostDaemonFacade.prototype.getPairedClients = | 511 remoting.HostDaemonFacade.prototype.getPairedClients = |
512 function(onDone, onError) { | 512 function(onDone, onError) { |
513 this.postMessage_({type: 'getPairedClients'}, onDone, onError); | 513 this.postMessage_({type: 'getPairedClients'}, onDone, onError); |
514 } | 514 } |
515 | 515 |
516 /** | 516 /** |
517 * Clears all paired clients from the registry. | 517 * Clears all paired clients from the registry. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 * @param {function(remoting.Error):void} onError Callback to call on error. | 558 * @param {function(remoting.Error):void} onError Callback to call on error. |
559 * @return {void} Nothing. | 559 * @return {void} Nothing. |
560 */ | 560 */ |
561 remoting.HostDaemonFacade.prototype.getCredentialsFromAuthCode = | 561 remoting.HostDaemonFacade.prototype.getCredentialsFromAuthCode = |
562 function(authorizationCode, onDone, onError) { | 562 function(authorizationCode, onDone, onError) { |
563 this.postMessage_({ | 563 this.postMessage_({ |
564 type: 'getCredentialsFromAuthCode', | 564 type: 'getCredentialsFromAuthCode', |
565 authorizationCode: authorizationCode | 565 authorizationCode: authorizationCode |
566 }, onDone, onError); | 566 }, onDone, onError); |
567 }; | 567 }; |
OLD | NEW |