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 "net/url_request/url_request_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 return new URLRequestRedirectJob( | 215 return new URLRequestRedirectJob( |
216 request, network_delegate, redirect_url, | 216 request, network_delegate, redirect_url, |
217 // Use status code 307 to preserve the method, so POST requests work. | 217 // Use status code 307 to preserve the method, so POST requests work. |
218 URLRequestRedirectJob::REDIRECT_307_TEMPORARY_REDIRECT); | 218 URLRequestRedirectJob::REDIRECT_307_TEMPORARY_REDIRECT); |
219 } | 219 } |
220 return new URLRequestHttpJob(request, | 220 return new URLRequestHttpJob(request, |
221 network_delegate, | 221 network_delegate, |
222 request->context()->http_user_agent_settings()); | 222 request->context()->http_user_agent_settings()); |
223 } | 223 } |
224 | 224 |
225 | |
226 URLRequestHttpJob::URLRequestHttpJob( | 225 URLRequestHttpJob::URLRequestHttpJob( |
227 URLRequest* request, | 226 URLRequest* request, |
228 NetworkDelegate* network_delegate, | 227 NetworkDelegate* network_delegate, |
229 const HttpUserAgentSettings* http_user_agent_settings) | 228 const HttpUserAgentSettings* http_user_agent_settings) |
230 : URLRequestJob(request, network_delegate), | 229 : URLRequestJob(request, network_delegate), |
231 priority_(DEFAULT_PRIORITY), | 230 priority_(DEFAULT_PRIORITY), |
232 response_info_(NULL), | 231 response_info_(NULL), |
233 response_cookies_save_index_(0), | 232 response_cookies_save_index_(0), |
234 proxy_auth_state_(AUTH_STATE_DONT_NEED_AUTH), | 233 proxy_auth_state_(AUTH_STATE_DONT_NEED_AUTH), |
235 server_auth_state_(AUTH_STATE_DONT_NEED_AUTH), | 234 server_auth_state_(AUTH_STATE_DONT_NEED_AUTH), |
236 start_callback_(base::Bind( | 235 start_callback_(base::Bind(&URLRequestHttpJob::OnStartCompleted, |
237 &URLRequestHttpJob::OnStartCompleted, base::Unretained(this))), | 236 base::Unretained(this))), |
238 notify_before_headers_sent_callback_(base::Bind( | 237 notify_before_headers_sent_callback_( |
239 &URLRequestHttpJob::NotifyBeforeSendHeadersCallback, | 238 base::Bind(&URLRequestHttpJob::NotifyBeforeSendHeadersCallback, |
240 base::Unretained(this))), | 239 base::Unretained(this))), |
241 read_in_progress_(false), | 240 read_in_progress_(false), |
242 transaction_(NULL), | |
243 throttling_entry_(NULL), | 241 throttling_entry_(NULL), |
244 sdch_dictionary_advertised_(false), | 242 sdch_dictionary_advertised_(false), |
245 sdch_test_activated_(false), | 243 sdch_test_activated_(false), |
246 sdch_test_control_(false), | 244 sdch_test_control_(false), |
247 is_cached_content_(false), | 245 is_cached_content_(false), |
248 request_creation_time_(), | 246 request_creation_time_(), |
249 packet_timing_enabled_(false), | 247 packet_timing_enabled_(false), |
250 done_(false), | 248 done_(false), |
251 bytes_observed_in_packets_(0), | 249 bytes_observed_in_packets_(0), |
252 request_time_snapshot_(), | 250 request_time_snapshot_(), |
253 final_packet_time_(), | 251 final_packet_time_(), |
254 filter_context_(new HttpFilterContext(this)), | 252 filter_context_(new HttpFilterContext(this)), |
255 weak_factory_(this), | 253 weak_factory_(this), |
256 on_headers_received_callback_(base::Bind( | 254 on_headers_received_callback_( |
257 &URLRequestHttpJob::OnHeadersReceivedCallback, | 255 base::Bind(&URLRequestHttpJob::OnHeadersReceivedCallback, |
258 base::Unretained(this))), | 256 base::Unretained(this))), |
259 awaiting_callback_(false), | 257 awaiting_callback_(false), |
260 http_transaction_delegate_(new HttpTransactionDelegateImpl( | 258 http_transaction_delegate_( |
261 request, network_delegate)), | 259 new HttpTransactionDelegateImpl(request, network_delegate)), |
262 http_user_agent_settings_(http_user_agent_settings) { | 260 http_user_agent_settings_(http_user_agent_settings) { |
263 URLRequestThrottlerManager* manager = request->context()->throttler_manager(); | 261 URLRequestThrottlerManager* manager = request->context()->throttler_manager(); |
264 if (manager) | 262 if (manager) |
265 throttling_entry_ = manager->RegisterRequestUrl(request->url()); | 263 throttling_entry_ = manager->RegisterRequestUrl(request->url()); |
266 | 264 |
267 ResetTimer(); | 265 ResetTimer(); |
268 } | 266 } |
269 | 267 |
270 URLRequestHttpJob::~URLRequestHttpJob() { | 268 URLRequestHttpJob::~URLRequestHttpJob() { |
271 CHECK(!awaiting_callback_); | 269 CHECK(!awaiting_callback_); |
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1486 | 1484 |
1487 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1485 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
1488 awaiting_callback_ = false; | 1486 awaiting_callback_ = false; |
1489 } | 1487 } |
1490 | 1488 |
1491 void URLRequestHttpJob::OnDetachRequest() { | 1489 void URLRequestHttpJob::OnDetachRequest() { |
1492 http_transaction_delegate_->OnDetachRequest(); | 1490 http_transaction_delegate_->OnDetachRequest(); |
1493 } | 1491 } |
1494 | 1492 |
1495 } // namespace net | 1493 } // namespace net |
OLD | NEW |