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 // Use URL parameters instead of headers, only because of crbug.com/116574. |
Jamie
2012/03/02 20:42:55
Can you rephrase this as a TODO, since we probably
| |
95 var params = { 'access_token': token }; | |
95 remoting.xhr.get( | 96 remoting.xhr.get( |
96 'https://www.googleapis.com/chromoting/v1/@me/hosts', | 97 'https://www.googleapis.com/chromoting/v1/@me/hosts', |
97 parseHostListResponse, '', headers); | 98 parseHostListResponse, params); |
98 }; | 99 }; |
99 remoting.oauth2.callWithToken(getHosts); | 100 remoting.oauth2.callWithToken(getHosts); |
100 }; | 101 }; |
101 | 102 |
102 /** | 103 /** |
103 * Handle the results of the host list request. A success response will | 104 * 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 | 105 * include a JSON-encoded list of host descriptions, which we display if we're |
105 * able to successfully parse it. | 106 * able to successfully parse it. |
106 * | 107 * |
107 * @param {XMLHttpRequest} xhr The XHR object for the host list request. | 108 * @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 */ | 264 */ |
264 remoting.HostList.COLLAPSED_ = 'collapsed'; | 265 remoting.HostList.COLLAPSED_ = 'collapsed'; |
265 | 266 |
266 /** | 267 /** |
267 * Key name under which Me2Me hosts are cached. | 268 * Key name under which Me2Me hosts are cached. |
268 */ | 269 */ |
269 remoting.HostList.HOSTS_KEY = 'me2me-cached-hosts'; | 270 remoting.HostList.HOSTS_KEY = 'me2me-cached-hosts'; |
270 | 271 |
271 /** @type {remoting.HostList} */ | 272 /** @type {remoting.HostList} */ |
272 remoting.hostList = null; | 273 remoting.hostList = null; |
OLD | NEW |