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

Side by Side Diff: remoting/webapp/crd/js/gcd_client.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
« no previous file with comments | « remoting/remoting_webapp_files.gypi ('k') | remoting/webapp/crd/js/gcd_host_list_api.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 * Client for the GCD REST API. 7 * Client for the GCD REST API.
8 * TODO: Add link to GCD docs. 8 * TODO: Add link to GCD docs.
9 */ 9 */
10 10
(...skipping 14 matching lines...) Expand all
25 * deviceId: string, 25 * deviceId: string,
26 * deviceDraft: Object 26 * deviceDraft: Object
27 * }} 27 * }}
28 */ 28 */
29 remoting.gcd.RegistrationTicket; 29 remoting.gcd.RegistrationTicket;
30 30
31 /** 31 /**
32 * TODO: Flesh out with typical fields. 32 * TODO: Flesh out with typical fields.
33 * @typedef {{ 33 * @typedef {{
34 * id:string, 34 * id:string,
35 * name:string 35 * name:string,
36 * state:(!Object|undefined),
37 * tags:(!Array<string>|undefined)
36 * }} 38 * }}
37 */ 39 */
38 remoting.gcd.Device; 40 remoting.gcd.Device;
39 41
40 /** 42 /**
41 * @typedef {!Object} 43 * @typedef {!Object}
42 */ 44 */
43 remoting.gcd.DevicePatch; 45 remoting.gcd.DevicePatch;
44 46
45 /** 47 /**
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 console.error('error finalizing registration ticket'); 201 console.error('error finalizing registration ticket');
200 throw remoting.Error.unexpected(); 202 throw remoting.Error.unexpected();
201 } 203 }
202 return responseAsGcdRegistrationTicket(response); 204 return responseAsGcdRegistrationTicket(response);
203 }); 205 });
204 }; 206 };
205 207
206 /** 208 /**
207 * Lists devices user has access to. 209 * Lists devices user has access to.
208 * TODO: Add link to GCD docs. 210 * TODO: Add link to GCD docs.
209 * @param {string=} opt_nameSubstring If present, the list of devices
210 * is filtered by GCD such that every device returned contains
211 * this string as as a substring of its |name| or |displayName|.
212 * @return {!Promise<!Array<remoting.gcd.Device>>} 211 * @return {!Promise<!Array<remoting.gcd.Device>>}
213 */ 212 */
214 remoting.gcd.Client.prototype.listDevices = function(opt_nameSubstring) { 213 remoting.gcd.Client.prototype.listDevices = function() {
215 return new remoting.Xhr({ 214 return new remoting.Xhr({
216 method: 'GET', 215 method: 'GET',
217 url: this.apiBaseUrl_ + '/devices', 216 url: this.apiBaseUrl_ + '/devices',
218 urlParams: {
219 nameSubstring: opt_nameSubstring || null
220 },
221 useIdentity: true, 217 useIdentity: true,
222 acceptJson: true 218 acceptJson: true
223 }).start().then(function(response) { 219 }).start().then(function(response) {
224 if (response.isError()) { 220 if (response.isError()) {
225 console.error('error getting device list'); 221 console.error('error getting device list');
226 throw remoting.Error.unexpected(); 222 throw remoting.Error.unexpected();
227 } 223 }
228 var hosts = responseAsGcdDeviceListResponse(response); 224 var hosts = responseAsGcdDeviceListResponse(response);
229 return hosts.devices || []; 225 return hosts.devices || [];
230 }); 226 });
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 }).start().then(function(response) { 267 }).start().then(function(response) {
272 if (response.isError()) { 268 if (response.isError()) {
273 console.error('error patching device'); 269 console.error('error patching device');
274 throw remoting.Error.unexpected(); 270 throw remoting.Error.unexpected();
275 } 271 }
276 return responseAsGcdDevice(response); 272 return responseAsGcdDevice(response);
277 }); 273 });
278 }; 274 };
279 275
280 })(); 276 })();
OLDNEW
« no previous file with comments | « remoting/remoting_webapp_files.gypi ('k') | remoting/webapp/crd/js/gcd_host_list_api.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698