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

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

Issue 918783002: CRD Viewport Management refactor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + plumbing remoting.Host into clientSession Created 5 years, 10 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 * REST API for host-list management. 7 * REST API for host-list management.
8 */ 8 */
9 9
10 'use strict'; 10 'use strict';
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 */ 102 */
103 remoting.HostListApiImpl.prototype.parseHostListResponse_ = 103 remoting.HostListApiImpl.prototype.parseHostListResponse_ =
104 function(onDone, onError, xhr) { 104 function(onDone, onError, xhr) {
105 if (xhr.status == 200) { 105 if (xhr.status == 200) {
106 var response = /** @type {{data: {items: Array}}} */ 106 var response = /** @type {{data: {items: Array}}} */
107 (base.jsonParseSafe(xhr.responseText)); 107 (base.jsonParseSafe(xhr.responseText));
108 if (!response || !response.data) { 108 if (!response || !response.data) {
109 console.error('Invalid "hosts" response from server.'); 109 console.error('Invalid "hosts" response from server.');
110 onError(remoting.Error.UNEXPECTED); 110 onError(remoting.Error.UNEXPECTED);
111 } else { 111 } else {
112 var hosts = response.data.items || []; 112 var items = response.data.items || [];
113 var hosts = items.map(
114 /** @param {Object} item */
115 function(item) {
116 var host = new remoting.Host();
117 host.hostName = item['hostName'];
118 host.hostId = item['hostId'];
119 host.status = item['status'];
120 host.jabberId = item['jabberId'];
121 host.publicKey = item['publicKey'];
122 host.hostVersion = item['hostVersion'];
123 host.tokenUrlPatterns = item['tokenUrlPatterns'];
124 host.updatedTime = item['updatedTime'];
125 host.hostOfflineReason = item['hostOfflineReason'];
126 return host;
127 });
113 onDone(hosts); 128 onDone(hosts);
114 } 129 }
115 } else { 130 } else {
116 onError(remoting.Error.fromHttpStatus(xhr.status)); 131 onError(remoting.Error.fromHttpStatus(xhr.status));
117 } 132 }
118 }; 133 };
119 134
120 /** @type {remoting.HostListApi} */ 135 /** @type {remoting.HostListApi} */
121 remoting.hostListApi = new remoting.HostListApiImpl(); 136 remoting.hostListApi = new remoting.HostListApiImpl();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698