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

Unified Diff: remoting/webapp/crd/js/host_controller.js

Issue 945033002: Updated XHR API so call sites are more descriptive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@xhr-test
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: remoting/webapp/crd/js/host_controller.js
diff --git a/remoting/webapp/crd/js/host_controller.js b/remoting/webapp/crd/js/host_controller.js
index 3dd8c93558c8d489aa53b8cb9fe2a97724bbc848..7a086fcc243b2f24845f2b94450bfd45bea810e8 100644
--- a/remoting/webapp/crd/js/host_controller.js
+++ b/remoting/webapp/crd/js/host_controller.js
@@ -273,11 +273,6 @@ remoting.HostController.prototype.start = function(hostPin, consent, onDone,
*/
function doRegisterHost(
hostName, privateKey, publicKey, hostClientId, oauthToken) {
- var headers = {
- 'Authorization': 'OAuth ' + oauthToken,
- 'Content-type' : 'application/json; charset=UTF-8'
- };
-
var newHostDetails = { data: {
hostId: newHostId,
hostName: hostName,
@@ -287,16 +282,16 @@ remoting.HostController.prototype.start = function(hostPin, consent, onDone,
var registerHostUrl =
remoting.settings.DIRECTORY_API_BASE_URL + '/@me/hosts';
- if (hostClientId) {
Jamie 2015/02/21 01:35:48 You've deleted this conditional. Was that intentio
John Williams 2015/02/23 23:00:55 Yes. The new version automagically omits URL param
- registerHostUrl += '?' + remoting.xhr.urlencodeParamHash(
- { hostClientId: hostClientId });
- }
-
- remoting.xhr.post(
- registerHostUrl,
- onRegistered.bind(null, hostName, publicKey, privateKey),
- JSON.stringify(newHostDetails),
- headers);
+ remoting.xhr.start({
+ method: 'POST',
+ url: remoting.settings.DIRECTORY_API_BASE_URL + '/@me/hosts',
+ urlParams: {
+ hostClientId: hostClientId
+ },
+ onDone: onRegistered.bind(null, hostName, publicKey, privateKey),
+ jsonContent: newHostDetails,
+ oauthToken: oauthToken
+ });
}
/**

Powered by Google App Engine
This is Rietveld 408576698