| 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 #include "remoting/host/service_client.h" | 5 #include "remoting/host/service_client.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 100 |
| 101 void ServiceClient::Core::MakeGaiaRequest( | 101 void ServiceClient::Core::MakeGaiaRequest( |
| 102 net::URLFetcher::RequestType request_type, | 102 net::URLFetcher::RequestType request_type, |
| 103 const std::string& url_suffix, | 103 const std::string& url_suffix, |
| 104 const std::string& request_body, | 104 const std::string& request_body, |
| 105 const std::string& oauth_access_token, | 105 const std::string& oauth_access_token, |
| 106 ServiceClient::Delegate* delegate) { | 106 ServiceClient::Delegate* delegate) { |
| 107 delegate_ = delegate; | 107 delegate_ = delegate; |
| 108 request_.reset(net::URLFetcher::Create( | 108 request_.reset(net::URLFetcher::Create( |
| 109 0, GURL(chromoting_hosts_url_ + url_suffix), request_type, this)); | 109 0, GURL(chromoting_hosts_url_ + url_suffix), request_type, this)); |
| 110 request_->SetRequestContext(request_context_getter_); | 110 request_->SetRequestContext(request_context_getter_.get()); |
| 111 request_->SetUploadData("application/json; charset=UTF-8", request_body); | 111 request_->SetUploadData("application/json; charset=UTF-8", request_body); |
| 112 request_->AddExtraRequestHeader("Authorization: OAuth " + oauth_access_token); | 112 request_->AddExtraRequestHeader("Authorization: OAuth " + oauth_access_token); |
| 113 request_->Start(); | 113 request_->Start(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 // URLFetcher::Delegate implementation. | 116 // URLFetcher::Delegate implementation. |
| 117 void ServiceClient::Core::OnURLFetchComplete( | 117 void ServiceClient::Core::OnURLFetchComplete( |
| 118 const net::URLFetcher* source) { | 118 const net::URLFetcher* source) { |
| 119 HandleResponse(source); | 119 HandleResponse(source); |
| 120 request_.reset(); | 120 request_.reset(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 163 } |
| 164 | 164 |
| 165 void ServiceClient::UnregisterHost( | 165 void ServiceClient::UnregisterHost( |
| 166 const std::string& host_id, | 166 const std::string& host_id, |
| 167 const std::string& oauth_access_token, | 167 const std::string& oauth_access_token, |
| 168 Delegate* delegate) { | 168 Delegate* delegate) { |
| 169 return core_->UnregisterHost(host_id, oauth_access_token, delegate); | 169 return core_->UnregisterHost(host_id, oauth_access_token, delegate); |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace gaia | 172 } // namespace gaia |
| OLD | NEW |