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 options.set_first_party_url(request_->first_party_for_cookies()); | 618 |
| 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(); |
619 | 626 |
620 request_->context()->cookie_store()->GetCookiesWithOptionsAsync( | 627 request_->context()->cookie_store()->GetCookiesWithOptionsAsync( |
621 request_->url(), options, base::Bind(&URLRequestHttpJob::OnCookiesLoaded, | 628 request_->url(), options, base::Bind(&URLRequestHttpJob::OnCookiesLoaded, |
622 weak_factory_.GetWeakPtr())); | 629 weak_factory_.GetWeakPtr())); |
623 } | 630 } |
624 | 631 |
625 void URLRequestHttpJob::CheckCookiePolicyAndLoad( | 632 void URLRequestHttpJob::CheckCookiePolicyAndLoad( |
626 const CookieList& cookie_list) { | 633 const CookieList& cookie_list) { |
627 if (CanGetCookies(cookie_list)) | 634 if (CanGetCookies(cookie_list)) |
628 DoLoadCookies(); | 635 DoLoadCookies(); |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1480 return override_response_headers_.get() ? | 1487 return override_response_headers_.get() ? |
1481 override_response_headers_.get() : | 1488 override_response_headers_.get() : |
1482 transaction_->GetResponseInfo()->headers.get(); | 1489 transaction_->GetResponseInfo()->headers.get(); |
1483 } | 1490 } |
1484 | 1491 |
1485 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1492 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
1486 awaiting_callback_ = false; | 1493 awaiting_callback_ = false; |
1487 } | 1494 } |
1488 | 1495 |
1489 } // namespace net | 1496 } // namespace net |
OLD | NEW |