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 * API for host-list management. | 7 * API for host-list management. |
8 */ | 8 */ |
9 | 9 |
10 'use strict'; | |
11 | |
12 /** @suppress {duplicate} */ | 10 /** @suppress {duplicate} */ |
13 var remoting = remoting || {}; | 11 var remoting = remoting || {}; |
14 | 12 |
13 (function() { | |
14 | |
15 'use strict'; | |
16 | |
15 /** @interface */ | 17 /** @interface */ |
16 remoting.HostListApi = function() { | 18 remoting.HostListApi = function() { |
17 }; | 19 }; |
18 | 20 |
19 /** | 21 /** |
20 * @param {string} newHostId | 22 * Registers a new host with the host registry service (either the |
21 * @param {string} hostName | 23 * Chromoting registry or GCD). |
22 * @param {string} publicKey | 24 * |
23 * @param {?string} hostClientId | 25 * @param {string} newHostId The ID of the new host the register. |
Jamie
2015/04/24 18:18:54
s/ the register//?
John Williams
2015/04/24 21:10:17
Done.
| |
26 * @param {string} hostName The user-visible name of the new host. | |
27 * @param {string} publicKey The public half of the host's key pair. | |
28 * @param {string} hostClientId The OAuth2 client ID of the host. | |
24 * @return {!Promise<string>} An OAuth2 auth code or the empty string. | 29 * @return {!Promise<string>} An OAuth2 auth code or the empty string. |
25 */ | 30 */ |
26 remoting.HostListApi.prototype.register; | 31 remoting.HostListApi.prototype.register = function( |
32 newHostId, hostName, publicKey, hostClientId) { | |
33 }; | |
27 | 34 |
28 /** | 35 /** |
29 * Fetch the list of hosts for a user. | 36 * Fetch the list of hosts for a user. |
30 * | 37 * |
31 * @return {!Promise<!Array<!remoting.Host>>} | 38 * @return {!Promise<!Array<!remoting.Host>>} |
32 */ | 39 */ |
33 remoting.HostListApi.prototype.get = function() { | 40 remoting.HostListApi.prototype.get = function() { |
34 }; | 41 }; |
35 | 42 |
36 /** | 43 /** |
37 * Update the information for a host. | 44 * Update the information for a host. |
38 * | 45 * |
39 * @param {string} hostId | 46 * @param {string} hostId |
40 * @param {string} hostName | 47 * @param {string} hostName |
41 * @param {string} hostPublicKey | 48 * @param {string} hostPublicKey |
42 * @return {!Promise<void>} | 49 * @return {!Promise<void>} |
43 */ | 50 */ |
44 remoting.HostListApi.prototype.put = | 51 remoting.HostListApi.prototype.put = |
45 function(hostId, hostName, hostPublicKey) { | 52 function(hostId, hostName, hostPublicKey) { |
46 }; | 53 }; |
47 | 54 |
48 /** | 55 /** |
49 * Delete a host. | 56 * Delete a host. |
50 * | 57 * |
51 * @param {string} hostId | 58 * @param {string} hostId |
52 * @return {!Promise<void>} | 59 * @return {!Promise<void>} |
53 */ | 60 */ |
54 remoting.HostListApi.prototype.remove = function(hostId) { | 61 remoting.HostListApi.prototype.remove = function(hostId) { |
55 }; | 62 }; |
63 | |
64 /** | |
65 * @private {remoting.HostListApi} | |
66 */ | |
67 var instance = null; | |
68 | |
69 /** | |
70 * @return {!remoting.HostListApi} | |
71 */ | |
72 remoting.HostListApi.getInstance = function() { | |
73 if (instance == null) { | |
74 instance = remoting.settings.USE_GCD ? | |
75 new remoting.HostListApiGcdImpl() : | |
76 new remoting.HostListApiImpl(); | |
77 } | |
78 return instance; | |
79 }; | |
80 | |
81 /** | |
82 * For testing. | |
83 * @param {remoting.HostListApi} newInstance | |
84 */ | |
85 remoting.HostListApi.setInstance = function(newInstance) { | |
86 instance = newInstance; | |
87 }; | |
88 | |
89 })(); | |
OLD | NEW |