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

Unified Diff: remoting/host/url_fetcher.cc

Issue 10160013: Implement HostPortAllocator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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
« no previous file with comments | « remoting/host/url_fetcher.h ('k') | remoting/protocol/libjingle_transport_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/url_fetcher.cc
diff --git a/remoting/host/url_fetcher.cc b/remoting/host/url_fetcher.cc
index 1844d0cd54d3c9166f690f2018fe6681e6912ecc..9f5084b67b59d35628c390f82c8dcf0397b4507e 100644
--- a/remoting/host/url_fetcher.cc
+++ b/remoting/host/url_fetcher.cc
@@ -24,6 +24,7 @@ class UrlFetcher::Core : public base::RefCountedThreadSafe<Core>,
net::URLRequestContextGetter* request_context_getter);
void SetUploadData(const std::string& upload_content_type,
const std::string& upload_content);
+ void SetHeader(const std::string& key, const std::string& value);
void Start(const UrlFetcher::DoneCallback& done_callback);
void Detach();
@@ -57,6 +58,8 @@ class UrlFetcher::Core : public base::RefCountedThreadSafe<Core>,
std::string upload_content_;
std::string upload_content_type_;
+ net::HttpRequestHeaders request_headers_;
+
scoped_ptr<net::URLRequest> request_;
scoped_refptr<net::IOBuffer> buffer_;
@@ -89,6 +92,11 @@ void UrlFetcher::Core::SetUploadData(const std::string& upload_content_type,
upload_content_ = upload_content;
}
+void UrlFetcher::Core::SetHeader(const std::string& key,
+ const std::string& value) {
+ request_headers_.SetHeader(key, value);
+}
+
void UrlFetcher::Core::Start(const UrlFetcher::DoneCallback& done_callback) {
done_callback_ = done_callback;
io_message_loop_ = request_context_getter_->GetIOMessageLoopProxy();
@@ -146,16 +154,16 @@ void UrlFetcher::Core::DoStart() {
DCHECK(!upload_content_type_.empty());
request_->set_method("POST");
- net::HttpRequestHeaders headers;
- headers.SetHeader(net::HttpRequestHeaders::kContentType,
- upload_content_type_);
- request_->SetExtraRequestHeaders(headers);
+ request_headers_.SetHeader(net::HttpRequestHeaders::kContentType,
+ upload_content_type_);
request_->AppendBytesToUpload(
upload_content_.data(), static_cast<int>(upload_content_.length()));
break;
}
+ request_->SetExtraRequestHeaders(request_headers_);
+
request_->Start();
}
@@ -200,6 +208,10 @@ void UrlFetcher::SetUploadData(const std::string& upload_content_type,
core_->SetUploadData(upload_content_type, upload_content);
}
+void UrlFetcher::SetHeader(const std::string& key, const std::string& value) {
+ core_->SetHeader(key, value);
+}
+
void UrlFetcher::Start(const DoneCallback& done_callback) {
core_->Start(done_callback);
}
« no previous file with comments | « remoting/host/url_fetcher.h ('k') | remoting/protocol/libjingle_transport_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698