OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 * Class representing the host-list portion of the home screen UI. | 7 * Class representing the host-list portion of the home screen UI. |
8 */ | 8 */ |
9 | 9 |
10 'use strict'; | 10 'use strict'; |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 if (!hostTableEntry) { | 214 if (!hostTableEntry) { |
215 console.error('No host registered for id ' + hostId); | 215 console.error('No host registered for id ' + hostId); |
216 return; | 216 return; |
217 } | 217 } |
218 /** @param {string} token */ | 218 /** @param {string} token */ |
219 var renameHost = function(token) { | 219 var renameHost = function(token) { |
220 var headers = { | 220 var headers = { |
221 'Authorization': 'OAuth ' + token, | 221 'Authorization': 'OAuth ' + token, |
222 'Content-type' : 'application/json; charset=UTF-8' | 222 'Content-type' : 'application/json; charset=UTF-8' |
223 }; | 223 }; |
224 var newHostDetails = { data: hostTableEntry.host }; | 224 var newHostDetails = { data: { |
| 225 hostId: hostTableEntry.host.hostId, |
| 226 hostName: hostTableEntry.host.hostName, |
| 227 publicKey: hostTableEntry.host.publicKey |
| 228 } }; |
225 remoting.xhr.put( | 229 remoting.xhr.put( |
226 'https://www.googleapis.com/chromoting/v1/@me/hosts/' + hostId, | 230 'https://www.googleapis.com/chromoting/v1/@me/hosts/' + hostId, |
227 function(xhr) {}, | 231 function(xhr) {}, |
228 JSON.stringify(newHostDetails), | 232 JSON.stringify(newHostDetails), |
229 headers); | 233 headers); |
230 } | 234 } |
231 remoting.oauth2.callWithToken(renameHost); | 235 remoting.oauth2.callWithToken(renameHost); |
232 }; | 236 }; |
233 | 237 |
234 /** | 238 /** |
235 * Class name for the host list when it is collapsed. | 239 * Class name for the host list when it is collapsed. |
236 * @private | 240 * @private |
237 */ | 241 */ |
238 remoting.HostList.COLLAPSED_ = 'collapsed'; | 242 remoting.HostList.COLLAPSED_ = 'collapsed'; |
239 | 243 |
240 /** @type {remoting.HostList} */ | 244 /** @type {remoting.HostList} */ |
241 remoting.hostList = null; | 245 remoting.hostList = null; |
OLD | NEW |