| 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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 // we'll definitely employ an SDCH filter (or tentative sdch filter) | 475 // we'll definitely employ an SDCH filter (or tentative sdch filter) |
| 476 // when we get a response. When done, we'll record histograms via | 476 // when we get a response. When done, we'll record histograms via |
| 477 // SDCH_DECODE or SDCH_PASSTHROUGH. Hence we need to record packet | 477 // SDCH_DECODE or SDCH_PASSTHROUGH. Hence we need to record packet |
| 478 // arrival times. | 478 // arrival times. |
| 479 packet_timing_enabled_ = true; | 479 packet_timing_enabled_ = true; |
| 480 } | 480 } |
| 481 } | 481 } |
| 482 } | 482 } |
| 483 | 483 |
| 484 if (http_user_agent_settings_) { | 484 if (http_user_agent_settings_) { |
| 485 // Only add default Accept-Language and Accept-Charset if the request | 485 // Only add default Accept-Language if the request didn't have it |
| 486 // didn't have them specified. | 486 // specified. |
| 487 std::string accept_language = | 487 std::string accept_language = |
| 488 http_user_agent_settings_->GetAcceptLanguage(); | 488 http_user_agent_settings_->GetAcceptLanguage(); |
| 489 if (!accept_language.empty()) { | 489 if (!accept_language.empty()) { |
| 490 request_info_.extra_headers.SetHeaderIfMissing( | 490 request_info_.extra_headers.SetHeaderIfMissing( |
| 491 HttpRequestHeaders::kAcceptLanguage, | 491 HttpRequestHeaders::kAcceptLanguage, |
| 492 accept_language); | 492 accept_language); |
| 493 } | 493 } |
| 494 std::string accept_charset = http_user_agent_settings_->GetAcceptCharset(); | |
| 495 if (!accept_charset.empty()) { | |
| 496 request_info_.extra_headers.SetHeaderIfMissing( | |
| 497 HttpRequestHeaders::kAcceptCharset, | |
| 498 accept_charset); | |
| 499 } | |
| 500 } | 494 } |
| 501 } | 495 } |
| 502 | 496 |
| 503 void URLRequestHttpJob::AddCookieHeaderAndStart() { | 497 void URLRequestHttpJob::AddCookieHeaderAndStart() { |
| 504 // No matter what, we want to report our status as IO pending since we will | 498 // No matter what, we want to report our status as IO pending since we will |
| 505 // be notifying our consumer asynchronously via OnStartCompleted. | 499 // be notifying our consumer asynchronously via OnStartCompleted. |
| 506 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); | 500 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); |
| 507 | 501 |
| 508 // If the request was destroyed, then there is no more work to do. | 502 // If the request was destroyed, then there is no more work to do. |
| 509 if (!request_) | 503 if (!request_) |
| (...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1574 | 1568 |
| 1575 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1569 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1576 awaiting_callback_ = false; | 1570 awaiting_callback_ = false; |
| 1577 } | 1571 } |
| 1578 | 1572 |
| 1579 void URLRequestHttpJob::OnDetachRequest() { | 1573 void URLRequestHttpJob::OnDetachRequest() { |
| 1580 http_transaction_delegate_->OnDetachRequest(); | 1574 http_transaction_delegate_->OnDetachRequest(); |
| 1581 } | 1575 } |
| 1582 | 1576 |
| 1583 } // namespace net | 1577 } // namespace net |
| OLD | NEW |