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

Side by Side Diff: remoting/webapp/crd/js/host_list_api.js

Issue 1161813006: Updated handling of GCD devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: oops--ignore Created 5 years, 6 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 unified diff | Download patch
OLDNEW
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 /** @suppress {duplicate} */ 10 /** @suppress {duplicate} */
11 var remoting = remoting || {}; 11 var remoting = remoting || {};
12 12
13 (function() { 13 (function() {
14 14
15 'use strict'; 15 'use strict';
16 16
17 /** @interface */ 17 /** @interface */
18 remoting.HostListApi = function() { 18 remoting.HostListApi = function() {
19 }; 19 };
20 20
21 /** 21 /**
22 * Registers a new host with the host registry service (either the 22 * Registers a new host with the host registry service (either the
23 * Chromoting registry or GCD). 23 * Chromoting registry or GCD).
24 * 24 *
25 * @param {string} newHostId The ID of the new host to register.
26 * @param {string} hostName The user-visible name of the new host. 25 * @param {string} hostName The user-visible name of the new host.
27 * @param {string} publicKey The public half of the host's key pair. 26 * @param {string} publicKey The public half of the host's key pair.
28 * @param {string} hostClientId The OAuth2 client ID of the host. 27 * @param {string} hostClientId The OAuth2 client ID of the host.
29 * @return {!Promise<remoting.HostListApi.RegisterResult>} 28 * @return {!Promise<remoting.HostListApi.RegisterResult>}
30 */ 29 */
31 remoting.HostListApi.prototype.register = function( 30 remoting.HostListApi.prototype.register = function(
32 newHostId, hostName, publicKey, hostClientId) { 31 hostName, publicKey, hostClientId) {
33 }; 32 };
34 33
35 /** 34 /**
36 * Fetch the list of hosts for a user. 35 * Fetch the list of hosts for a user.
37 * 36 *
38 * @return {!Promise<!Array<!remoting.Host>>} 37 * @return {!Promise<!Array<!remoting.Host>>}
39 */ 38 */
40 remoting.HostListApi.prototype.get = function() { 39 remoting.HostListApi.prototype.get = function() {
41 }; 40 };
42 41
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 * @private {remoting.HostListApi} 74 * @private {remoting.HostListApi}
76 */ 75 */
77 var instance = null; 76 var instance = null;
78 77
79 /** 78 /**
80 * @return {!remoting.HostListApi} 79 * @return {!remoting.HostListApi}
81 */ 80 */
82 remoting.HostListApi.getInstance = function() { 81 remoting.HostListApi.getInstance = function() {
83 if (instance == null) { 82 if (instance == null) {
84 instance = remoting.settings.USE_GCD ? 83 instance = remoting.settings.USE_GCD ?
85 new remoting.HostListApiGcdImpl() : 84 new remoting.GcdHostListApi() :
86 new remoting.HostListApiImpl(); 85 new remoting.LegacyHostListApi();
87 } 86 }
88 return instance; 87 return instance;
89 }; 88 };
90 89
91 /** 90 /**
92 * For testing. 91 * For testing.
93 * @param {remoting.HostListApi} newInstance 92 * @param {remoting.HostListApi} newInstance
94 */ 93 */
95 remoting.HostListApi.setInstance = function(newInstance) { 94 remoting.HostListApi.setInstance = function(newInstance) {
96 instance = newInstance; 95 instance = newInstance;
97 }; 96 };
98 97
99 })(); 98 })();
100 99
101 /** 100 /**
102 * Information returned from the registry/GCD server when registering 101 * Information returned from the registry/GCD server when registering
103 * a device. GCD will fill in all three fields; the Chromoting 102 * a device.
104 * registry will only return an auth code; other fields will be empty.
105 * 103 *
106 * The fields are: 104 * The fields are:
107 * 105 *
108 * authCode: An OAuth2 authorization code that can be exchanged for a 106 * authCode: An OAuth2 authorization code that can be exchanged for a
109 * refresh token. 107 * refresh token.
110 * 108 *
111 * email: The email/XMPP address of the robot account associated 109 * email: The email/XMPP address of the robot account associated with
112 * with this device. 110 * this device. The Chromoting directory sets this field to the
111 * empty string; GCD returns a real email address.
113 * 112 *
114 * gcmId: The ID string assigned to this device by GCD. 113 * hostId: The ID of the newly registered host.
114 *
115 * isLegacy: True for registrations in the legacy directory, false for
116 * registrations in GCD.
115 * 117 *
116 * @typedef {{ 118 * @typedef {{
117 * authCode: string, 119 * authCode: string,
118 * email: string, 120 * email: string,
119 * gcdId: string 121 * hostId: string,
122 * isLegacy: boolean
120 * }} 123 * }}
121 */ 124 */
122 remoting.HostListApi.RegisterResult; 125 remoting.HostListApi.RegisterResult;
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/host_controller_unittest.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