OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 */ | 84 */ |
85 remoting.HostList.prototype.refresh = function(onDone) { | 85 remoting.HostList.prototype.refresh = function(onDone) { |
86 /** @type {remoting.HostList} */ | 86 /** @type {remoting.HostList} */ |
87 var that = this; | 87 var that = this; |
88 /** @param {XMLHttpRequest} xhr The response from the server. */ | 88 /** @param {XMLHttpRequest} xhr The response from the server. */ |
89 var parseHostListResponse = function(xhr) { | 89 var parseHostListResponse = function(xhr) { |
90 that.parseHostListResponse_(xhr, onDone); | 90 that.parseHostListResponse_(xhr, onDone); |
91 } | 91 } |
92 /** @param {string} token The OAuth2 token. */ | 92 /** @param {string} token The OAuth2 token. */ |
93 var getHosts = function(token) { | 93 var getHosts = function(token) { |
94 var headers = { 'Authorization': 'OAuth ' + token }; | 94 // TODO(simonmorris): Pass the access token in a header, not a URL |
| 95 // parameter, when crbug.com/116574 has a better fix. |
| 96 var params = { 'access_token': token }; |
95 remoting.xhr.get( | 97 remoting.xhr.get( |
96 'https://www.googleapis.com/chromoting/v1/@me/hosts', | 98 'https://www.googleapis.com/chromoting/v1/@me/hosts', |
97 parseHostListResponse, '', headers); | 99 parseHostListResponse, params); |
98 }; | 100 }; |
99 remoting.oauth2.callWithToken(getHosts); | 101 remoting.oauth2.callWithToken(getHosts); |
100 }; | 102 }; |
101 | 103 |
102 /** | 104 /** |
103 * Handle the results of the host list request. A success response will | 105 * Handle the results of the host list request. A success response will |
104 * include a JSON-encoded list of host descriptions, which we display if we're | 106 * include a JSON-encoded list of host descriptions, which we display if we're |
105 * able to successfully parse it. | 107 * able to successfully parse it. |
106 * | 108 * |
107 * @param {XMLHttpRequest} xhr The XHR object for the host list request. | 109 * @param {XMLHttpRequest} xhr The XHR object for the host list request. |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 */ | 265 */ |
264 remoting.HostList.COLLAPSED_ = 'collapsed'; | 266 remoting.HostList.COLLAPSED_ = 'collapsed'; |
265 | 267 |
266 /** | 268 /** |
267 * Key name under which Me2Me hosts are cached. | 269 * Key name under which Me2Me hosts are cached. |
268 */ | 270 */ |
269 remoting.HostList.HOSTS_KEY = 'me2me-cached-hosts'; | 271 remoting.HostList.HOSTS_KEY = 'me2me-cached-hosts'; |
270 | 272 |
271 /** @type {remoting.HostList} */ | 273 /** @type {remoting.HostList} */ |
272 remoting.hostList = null; | 274 remoting.hostList = null; |
OLD | NEW |