Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(762)

Unified Diff: remoting/webapp/crd/js/host_list_api.js

Issue 1094133003: Added (incomplete) implementation of HostListApi using GCD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gcd-client-fix
Patch Set: for submit Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/webapp/crd/js/host_list.js ('k') | remoting/webapp/crd/js/host_list_api_gcd_impl.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/crd/js/host_list_api.js
diff --git a/remoting/webapp/crd/js/host_list_api.js b/remoting/webapp/crd/js/host_list_api.js
index 9b63ccb71c38a2a29891257a3ee14eeb1a47e26f..4e6cd72babb97d6fdfb9bb4cc44e44acf5a6ef04 100644
--- a/remoting/webapp/crd/js/host_list_api.js
+++ b/remoting/webapp/crd/js/host_list_api.js
@@ -7,23 +7,30 @@
* API for host-list management.
*/
-'use strict';
-
/** @suppress {duplicate} */
var remoting = remoting || {};
+(function() {
+
+'use strict';
+
/** @interface */
remoting.HostListApi = function() {
};
/**
- * @param {string} newHostId
- * @param {string} hostName
- * @param {string} publicKey
- * @param {?string} hostClientId
+ * Registers a new host with the host registry service (either the
+ * Chromoting registry or GCD).
+ *
+ * @param {string} newHostId The ID of the new host to register.
+ * @param {string} hostName The user-visible name of the new host.
+ * @param {string} publicKey The public half of the host's key pair.
+ * @param {string} hostClientId The OAuth2 client ID of the host.
* @return {!Promise<string>} An OAuth2 auth code or the empty string.
*/
-remoting.HostListApi.prototype.register;
+remoting.HostListApi.prototype.register = function(
+ newHostId, hostName, publicKey, hostClientId) {
+};
/**
* Fetch the list of hosts for a user.
@@ -53,3 +60,30 @@ remoting.HostListApi.prototype.put =
*/
remoting.HostListApi.prototype.remove = function(hostId) {
};
+
+/**
+ * @private {remoting.HostListApi}
+ */
+var instance = null;
+
+/**
+ * @return {!remoting.HostListApi}
+ */
+remoting.HostListApi.getInstance = function() {
+ if (instance == null) {
+ instance = remoting.settings.USE_GCD ?
+ new remoting.HostListApiGcdImpl() :
+ new remoting.HostListApiImpl();
+ }
+ return instance;
+};
+
+/**
+ * For testing.
+ * @param {remoting.HostListApi} newInstance
+ */
+remoting.HostListApi.setInstance = function(newInstance) {
+ instance = newInstance;
+};
+
+})();
« no previous file with comments | « remoting/webapp/crd/js/host_list.js ('k') | remoting/webapp/crd/js/host_list_api_gcd_impl.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698