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 * REST API for host-list management. | 7 * REST API for host-list management. |
8 */ | 8 */ |
9 | 9 |
10 'use strict'; | 10 'use strict'; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 hosts = response.data.items || []; |
113 onDone(hosts); | 113 onDone(hosts); |
114 } | 114 } |
115 } else { | 115 } else { |
116 onError(remoting.Error.fromHttpError(xhr.status)); | 116 onError(remoting.Error.fromHttpStatus(xhr.status)); |
117 } | 117 } |
118 }; | 118 }; |
119 | 119 |
120 /** @type {remoting.HostListApi} */ | 120 /** @type {remoting.HostListApi} */ |
121 remoting.hostListApi = new remoting.HostListApiImpl(); | 121 remoting.hostListApi = new remoting.HostListApiImpl(); |
OLD | NEW |