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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 base::Bind(&URLRequestHttpJob::CheckCookiePolicyAndLoad, | 608 base::Bind(&URLRequestHttpJob::CheckCookiePolicyAndLoad, |
609 weak_factory_.GetWeakPtr())); | 609 weak_factory_.GetWeakPtr())); |
610 } else { | 610 } else { |
611 DoStartTransaction(); | 611 DoStartTransaction(); |
612 } | 612 } |
613 } | 613 } |
614 | 614 |
615 void URLRequestHttpJob::DoLoadCookies() { | 615 void URLRequestHttpJob::DoLoadCookies() { |
616 CookieOptions options; | 616 CookieOptions options; |
617 options.set_include_httponly(); | 617 options.set_include_httponly(); |
618 | 618 options.set_first_party_url(request_->first_party_for_cookies()); |
619 // TODO(mkwst): Drop this `if` once we decide whether or not to ship | |
620 // first-party cookies: https://crbug.com/459154 | |
621 if (network_delegate() && | |
622 network_delegate()->FirstPartyOnlyCookieExperimentEnabled()) | |
623 options.set_first_party_url(request_->first_party_for_cookies()); | |
624 else | |
625 options.set_include_first_party_only(); | |
626 | 619 |
627 request_->context()->cookie_store()->GetCookiesWithOptionsAsync( | 620 request_->context()->cookie_store()->GetCookiesWithOptionsAsync( |
628 request_->url(), options, base::Bind(&URLRequestHttpJob::OnCookiesLoaded, | 621 request_->url(), options, base::Bind(&URLRequestHttpJob::OnCookiesLoaded, |
629 weak_factory_.GetWeakPtr())); | 622 weak_factory_.GetWeakPtr())); |
630 } | 623 } |
631 | 624 |
632 void URLRequestHttpJob::CheckCookiePolicyAndLoad( | 625 void URLRequestHttpJob::CheckCookiePolicyAndLoad( |
633 const CookieList& cookie_list) { | 626 const CookieList& cookie_list) { |
634 if (CanGetCookies(cookie_list)) | 627 if (CanGetCookies(cookie_list)) |
635 DoLoadCookies(); | 628 DoLoadCookies(); |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1487 return override_response_headers_.get() ? | 1480 return override_response_headers_.get() ? |
1488 override_response_headers_.get() : | 1481 override_response_headers_.get() : |
1489 transaction_->GetResponseInfo()->headers.get(); | 1482 transaction_->GetResponseInfo()->headers.get(); |
1490 } | 1483 } |
1491 | 1484 |
1492 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1485 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
1493 awaiting_callback_ = false; | 1486 awaiting_callback_ = false; |
1494 } | 1487 } |
1495 | 1488 |
1496 } // namespace net | 1489 } // namespace net |
OLD | NEW |