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 * @param {string} newHostId |
21 * @param {string} hostName | 23 * @param {string} hostName |
22 * @param {string} publicKey | 24 * @param {string} publicKey |
23 * @param {?string} hostClientId | 25 * @param {string} hostClientId |
24 * @return {!Promise<string>} An OAuth2 auth code or the empty string. | 26 * @return {!Promise<string>} An OAuth2 auth code or the empty string. |
25 */ | 27 */ |
26 remoting.HostListApi.prototype.register; | 28 remoting.HostListApi.prototype.register; |
Jamie
2015/04/22 23:46:01
This method is not implemented by remoting.HostLis
John Williams
2015/04/23 23:55:42
It's implemented by remoting.HostListApiImpl since
| |
27 | 29 |
28 /** | 30 /** |
29 * Fetch the list of hosts for a user. | 31 * Fetch the list of hosts for a user. |
30 * | 32 * |
31 * @return {!Promise<!Array<!remoting.Host>>} | 33 * @return {!Promise<!Array<!remoting.Host>>} |
32 */ | 34 */ |
33 remoting.HostListApi.prototype.get = function() { | 35 remoting.HostListApi.prototype.get = function() { |
34 }; | 36 }; |
35 | 37 |
36 /** | 38 /** |
37 * Update the information for a host. | 39 * Update the information for a host. |
38 * | 40 * |
39 * @param {string} hostId | 41 * @param {string} hostId |
40 * @param {string} hostName | 42 * @param {string} hostName |
41 * @param {string} hostPublicKey | 43 * @param {string} hostPublicKey |
42 * @return {!Promise<void>} | 44 * @return {!Promise<void>} |
43 */ | 45 */ |
44 remoting.HostListApi.prototype.put = | 46 remoting.HostListApi.prototype.put = |
45 function(hostId, hostName, hostPublicKey) { | 47 function(hostId, hostName, hostPublicKey) { |
46 }; | 48 }; |
47 | 49 |
48 /** | 50 /** |
49 * Delete a host. | 51 * Delete a host. |
50 * | 52 * |
51 * @param {string} hostId | 53 * @param {string} hostId |
52 * @return {!Promise<void>} | 54 * @return {!Promise<void>} |
53 */ | 55 */ |
54 remoting.HostListApi.prototype.remove = function(hostId) { | 56 remoting.HostListApi.prototype.remove = function(hostId) { |
55 }; | 57 }; |
58 | |
59 /** | |
60 * @private {remoting.HostListApi} | |
61 */ | |
62 var instance = null; | |
63 | |
64 /** | |
65 * @return {!remoting.HostListApi} | |
66 */ | |
67 remoting.HostListApi.getInstance = function() { | |
68 if (instance == null) { | |
69 instance = remoting.settings.USE_GCD ? | |
70 new remoting.HostListApiGcdImpl() : | |
71 new remoting.HostListApiImpl(); | |
72 } | |
73 return instance; | |
74 }; | |
75 | |
76 /** | |
77 * For testing. | |
78 * @param {remoting.HostListApi} newInstance | |
79 */ | |
80 remoting.HostListApi.setInstance = function(newInstance) { | |
81 instance = newInstance; | |
82 }; | |
83 | |
84 })(); | |
OLD | NEW |