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/url_fetcher.h" | 5 #include "remoting/host/url_fetcher.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // We are done. Post a task to call |done_callback_|. | 136 // We are done. Post a task to call |done_callback_|. |
137 delegate_message_loop_->PostTask( | 137 delegate_message_loop_->PostTask( |
138 FROM_HERE, base::Bind(&UrlFetcher::Core::CallCallback, this, status, | 138 FROM_HERE, base::Bind(&UrlFetcher::Core::CallCallback, this, status, |
139 request_->GetResponseCode())); | 139 request_->GetResponseCode())); |
140 } | 140 } |
141 } | 141 } |
142 | 142 |
143 void UrlFetcher::Core::DoStart() { | 143 void UrlFetcher::Core::DoStart() { |
144 DCHECK(network_task_runner_->BelongsToCurrentThread()); | 144 DCHECK(network_task_runner_->BelongsToCurrentThread()); |
145 | 145 |
146 request_.reset(new net::URLRequest(url_, this)); | 146 request_.reset(new net::URLRequest( |
147 request_->set_context(request_context_getter_->GetURLRequestContext()); | 147 url_, this, request_context_getter_->GetURLRequestContext())); |
148 | 148 |
149 switch (method_) { | 149 switch (method_) { |
150 case GET: | 150 case GET: |
151 break; | 151 break; |
152 | 152 |
153 case POST: | 153 case POST: |
154 DCHECK(!upload_content_.empty()); | 154 DCHECK(!upload_content_.empty()); |
155 DCHECK(!upload_content_type_.empty()); | 155 DCHECK(!upload_content_type_.empty()); |
156 request_->set_method("POST"); | 156 request_->set_method("POST"); |
157 | 157 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 211 |
212 void UrlFetcher::SetHeader(const std::string& key, const std::string& value) { | 212 void UrlFetcher::SetHeader(const std::string& key, const std::string& value) { |
213 core_->SetHeader(key, value); | 213 core_->SetHeader(key, value); |
214 } | 214 } |
215 | 215 |
216 void UrlFetcher::Start(const DoneCallback& done_callback) { | 216 void UrlFetcher::Start(const DoneCallback& done_callback) { |
217 core_->Start(done_callback); | 217 core_->Start(done_callback); |
218 } | 218 } |
219 | 219 |
220 } // namespace remoting | 220 } // namespace remoting |
OLD | NEW |