| 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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 base::Bind(&URLRequestHttpJob::CheckCookiePolicyAndLoad, | 622 base::Bind(&URLRequestHttpJob::CheckCookiePolicyAndLoad, |
| 623 weak_factory_.GetWeakPtr())); | 623 weak_factory_.GetWeakPtr())); |
| 624 } else { | 624 } else { |
| 625 DoStartTransaction(); | 625 DoStartTransaction(); |
| 626 } | 626 } |
| 627 } | 627 } |
| 628 | 628 |
| 629 void URLRequestHttpJob::DoLoadCookies() { | 629 void URLRequestHttpJob::DoLoadCookies() { |
| 630 CookieOptions options; | 630 CookieOptions options; |
| 631 options.set_include_httponly(); | 631 options.set_include_httponly(); |
| 632 options.set_include_first_party_only(); | |
| 633 | 632 |
| 634 // TODO(mkwst): Pipe a switch down here to allow us to decide whether we | 633 // TODO(mkwst): Drop this `if` once we decide whether or not to ship |
| 635 // should enforce "first-party only" cookies or not (by setting |options|'s | 634 // first-party cookies: https://crbug.com/459154 |
| 636 // first-party-url to the first-party-for-cookies value. crbug.com/459154 | 635 if (network_delegate() && |
| 636 network_delegate()->FirstPartyOnlyCookieExperimentEnabled()) |
| 637 options.set_first_party_url(request_->first_party_for_cookies()); |
| 638 else |
| 639 options.set_include_first_party_only(); |
| 637 | 640 |
| 638 GetCookieStore()->GetCookiesWithOptionsAsync( | 641 GetCookieStore()->GetCookiesWithOptionsAsync( |
| 639 request_->url(), options, | 642 request_->url(), options, |
| 640 base::Bind(&URLRequestHttpJob::OnCookiesLoaded, | 643 base::Bind(&URLRequestHttpJob::OnCookiesLoaded, |
| 641 weak_factory_.GetWeakPtr())); | 644 weak_factory_.GetWeakPtr())); |
| 642 } | 645 } |
| 643 | 646 |
| 644 void URLRequestHttpJob::CheckCookiePolicyAndLoad( | 647 void URLRequestHttpJob::CheckCookiePolicyAndLoad( |
| 645 const CookieList& cookie_list) { | 648 const CookieList& cookie_list) { |
| 646 if (CanGetCookies(cookie_list)) | 649 if (CanGetCookies(cookie_list)) |
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1499 return override_response_headers_.get() ? | 1502 return override_response_headers_.get() ? |
| 1500 override_response_headers_.get() : | 1503 override_response_headers_.get() : |
| 1501 transaction_->GetResponseInfo()->headers.get(); | 1504 transaction_->GetResponseInfo()->headers.get(); |
| 1502 } | 1505 } |
| 1503 | 1506 |
| 1504 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1507 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1505 awaiting_callback_ = false; | 1508 awaiting_callback_ = false; |
| 1506 } | 1509 } |
| 1507 | 1510 |
| 1508 } // namespace net | 1511 } // namespace net |
| OLD | NEW |