Chromium Code Reviews| 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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 652 weak_factory_.GetWeakPtr())); | 652 weak_factory_.GetWeakPtr())); |
| 653 } else { | 653 } else { |
| 654 DoStartTransaction(); | 654 DoStartTransaction(); |
| 655 } | 655 } |
| 656 } | 656 } |
| 657 | 657 |
| 658 void URLRequestHttpJob::DoLoadCookies() { | 658 void URLRequestHttpJob::DoLoadCookies() { |
| 659 CookieOptions options; | 659 CookieOptions options; |
| 660 options.set_include_httponly(); | 660 options.set_include_httponly(); |
| 661 | 661 |
| 662 // TODO(mkwst): Drop this `if` once we decide whether or not to ship | 662 url::Origin origin(request_->url()); |
| 663 // first-party cookies: https://crbug.com/459154 | 663 |
|
nasko
2015/10/20 22:36:30
nit: No need for empty line.
Mike West
2015/10/22 13:17:02
Done.
| |
| 664 if (network_delegate() && | 664 if (origin.IsSameOriginWith( |
| 665 network_delegate()->AreExperimentalCookieFeaturesEnabled()) | 665 url::Origin(request_->first_party_for_cookies())) && |
| 666 options.set_first_party(url::Origin(request_->first_party_for_cookies())); | 666 (request_->is_safe_method() || |
| 667 else | 667 origin.IsSameOriginWith(request_->initiator()))) { |
| 668 options.set_include_first_party_only(); | 668 options.set_include_first_party_only(); |
| 669 } | |
| 670 | |
| 671 // TODO(mkwst): If first-party-only cookies aren't enabled, pretend the | |
| 672 // request is first-party regardless, in order to include all cookies. Drop | |
| 673 // this check once we decide whether or not we're shipping this feature: | |
| 674 // https://crbug.com/459154 | |
| 675 if (!network_delegate() || | |
| 676 !network_delegate()->AreExperimentalCookieFeaturesEnabled()) { | |
| 677 options.set_include_first_party_only(); | |
| 678 } | |
| 669 | 679 |
| 670 request_->context()->cookie_store()->GetCookiesWithOptionsAsync( | 680 request_->context()->cookie_store()->GetCookiesWithOptionsAsync( |
| 671 request_->url(), options, base::Bind(&URLRequestHttpJob::OnCookiesLoaded, | 681 request_->url(), options, base::Bind(&URLRequestHttpJob::OnCookiesLoaded, |
| 672 weak_factory_.GetWeakPtr())); | 682 weak_factory_.GetWeakPtr())); |
| 673 } | 683 } |
| 674 | 684 |
| 675 void URLRequestHttpJob::CheckCookiePolicyAndLoad( | 685 void URLRequestHttpJob::CheckCookiePolicyAndLoad( |
| 676 const CookieList& cookie_list) { | 686 const CookieList& cookie_list) { |
| 677 if (CanGetCookies(cookie_list)) | 687 if (CanGetCookies(cookie_list)) |
| 678 DoLoadCookies(); | 688 DoLoadCookies(); |
| (...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1578 return override_response_headers_.get() ? | 1588 return override_response_headers_.get() ? |
| 1579 override_response_headers_.get() : | 1589 override_response_headers_.get() : |
| 1580 transaction_->GetResponseInfo()->headers.get(); | 1590 transaction_->GetResponseInfo()->headers.get(); |
| 1581 } | 1591 } |
| 1582 | 1592 |
| 1583 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1593 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1584 awaiting_callback_ = false; | 1594 awaiting_callback_ = false; |
| 1585 } | 1595 } |
| 1586 | 1596 |
| 1587 } // namespace net | 1597 } // namespace net |
| OLD | NEW |