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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 // Our consumer should have made sure that this is a safe referrer. See for | 263 // Our consumer should have made sure that this is a safe referrer. See for |
264 // instance WebCore::FrameLoader::HideReferrer. | 264 // instance WebCore::FrameLoader::HideReferrer. |
265 if (referrer.is_valid()) { | 265 if (referrer.is_valid()) { |
266 request_info_.extra_headers.SetHeader(HttpRequestHeaders::kReferer, | 266 request_info_.extra_headers.SetHeader(HttpRequestHeaders::kReferer, |
267 referrer.spec()); | 267 referrer.spec()); |
268 } | 268 } |
269 | 269 |
270 request_info_.extra_headers.SetHeaderIfMissing( | 270 request_info_.extra_headers.SetHeaderIfMissing( |
271 HttpRequestHeaders::kUserAgent, | 271 HttpRequestHeaders::kUserAgent, |
272 http_user_agent_settings_ ? | 272 http_user_agent_settings_ ? |
273 http_user_agent_settings_->GetUserAgent() : std::string()); | 273 http_user_agent_settings_->GetUserAgent(request_->url()) : |
| 274 std::string()); |
274 | 275 |
275 AddExtraHeaders(); | 276 AddExtraHeaders(); |
276 AddCookieHeaderAndStart(); | 277 AddCookieHeaderAndStart(); |
277 } | 278 } |
278 | 279 |
279 void URLRequestHttpJob::Kill() { | 280 void URLRequestHttpJob::Kill() { |
280 if (!transaction_.get()) | 281 if (!transaction_.get()) |
281 return; | 282 return; |
282 | 283 |
283 weak_factory_.InvalidateWeakPtrs(); | 284 weak_factory_.InvalidateWeakPtrs(); |
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1465 return override_response_headers_.get() ? | 1466 return override_response_headers_.get() ? |
1466 override_response_headers_.get() : | 1467 override_response_headers_.get() : |
1467 transaction_->GetResponseInfo()->headers.get(); | 1468 transaction_->GetResponseInfo()->headers.get(); |
1468 } | 1469 } |
1469 | 1470 |
1470 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1471 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
1471 awaiting_callback_ = false; | 1472 awaiting_callback_ = false; |
1472 } | 1473 } |
1473 | 1474 |
1474 } // namespace net | 1475 } // namespace net |
OLD | NEW |