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