Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: net/url_request/url_request_http_job.cc

Issue 1615773005: Rename first-party-only cookies to same-site cookies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Missed a few. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 // No matter what, we want to report our status as IO pending since we will 664 // No matter what, we want to report our status as IO pending since we will
665 // be notifying our consumer asynchronously via OnStartCompleted. 665 // be notifying our consumer asynchronously via OnStartCompleted.
666 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); 666 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
667 667
668 // If the request was destroyed, then there is no more work to do. 668 // If the request was destroyed, then there is no more work to do.
669 if (!request_) 669 if (!request_)
670 return; 670 return;
671 671
672 CookieStore* cookie_store = request_->context()->cookie_store(); 672 CookieStore* cookie_store = request_->context()->cookie_store();
673 if (cookie_store && !(request_info_.load_flags & LOAD_DO_NOT_SEND_COOKIES)) { 673 if (cookie_store && !(request_info_.load_flags & LOAD_DO_NOT_SEND_COOKIES)) {
674 cookie_store->GetAllCookiesForURLAsync( 674 cookie_store->GetAllCookiesForURLAsync(
mmenke 2016/01/25 18:47:10 Erm...wait...We get cookies without options, and p
mmenke 2016/01/26 15:08:05 Do you have any idea about this? I was unaware of
Mike West 2016/01/26 16:19:13 Sorry, I missed this comment in the first pass. I
675 request_->url(), 675 request_->url(),
676 base::Bind(&URLRequestHttpJob::CheckCookiePolicyAndLoad, 676 base::Bind(&URLRequestHttpJob::CheckCookiePolicyAndLoad,
677 weak_factory_.GetWeakPtr())); 677 weak_factory_.GetWeakPtr()));
678 } else { 678 } else {
679 DoStartTransaction(); 679 DoStartTransaction();
680 } 680 }
681 } 681 }
682 682
683 void URLRequestHttpJob::DoLoadCookies() { 683 void URLRequestHttpJob::DoLoadCookies() {
684 CookieOptions options; 684 CookieOptions options;
685 options.set_include_httponly(); 685 options.set_include_httponly();
686 686
687 // TODO(mkwst): If first-party-only cookies aren't enabled, pretend the 687 // TODO(mkwst): If same-site cookies aren't enabled, pretend the request is
688 // request is first-party regardless, in order to include all cookies. Drop 688 // same-site regardless, in order to include all cookies. Drop this check once
689 // this check once we decide whether or not we're shipping this feature: 689 // we decide whether or not we're shipping this feature:
690 // https://crbug.com/459154 690 // https://crbug.com/459154
691 url::Origin requested_origin(request_->url()); 691 url::Origin requested_origin(request_->url());
692 if (!network_delegate() || 692 if (!network_delegate() ||
693 !network_delegate()->AreExperimentalCookieFeaturesEnabled()) { 693 !network_delegate()->AreExperimentalCookieFeaturesEnabled()) {
694 options.set_include_first_party_only_cookies(); 694 options.set_include_samesite();
695 } else if (requested_origin.IsSameOriginWith( 695 } else if (requested_origin.IsSameOriginWith(
696 url::Origin(request_->first_party_for_cookies())) && 696 url::Origin(request_->first_party_for_cookies())) &&
mmenke 2016/01/25 18:47:10 Should first_party_for_cookies be renamed to same_
Mike West 2016/01/26 11:05:45 Maybe. Our UI still talks about blocking "third-pa
697 (IsMethodSafe(request_->method()) || 697 (IsMethodSafe(request_->method()) ||
698 requested_origin.IsSameOriginWith(request_->initiator()))) { 698 requested_origin.IsSameOriginWith(request_->initiator()))) {
699 options.set_include_first_party_only_cookies(); 699 options.set_include_samesite();
700 } 700 }
701 701
702 request_->context()->cookie_store()->GetCookiesWithOptionsAsync( 702 request_->context()->cookie_store()->GetCookiesWithOptionsAsync(
703 request_->url(), options, base::Bind(&URLRequestHttpJob::OnCookiesLoaded, 703 request_->url(), options, base::Bind(&URLRequestHttpJob::OnCookiesLoaded,
704 weak_factory_.GetWeakPtr())); 704 weak_factory_.GetWeakPtr()));
705 } 705 }
706 706
707 void URLRequestHttpJob::CheckCookiePolicyAndLoad( 707 void URLRequestHttpJob::CheckCookiePolicyAndLoad(
708 const CookieList& cookie_list) { 708 const CookieList& cookie_list) {
709 if (CanGetCookies(cookie_list)) 709 if (CanGetCookies(cookie_list))
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 return override_response_headers_.get() ? 1627 return override_response_headers_.get() ?
1628 override_response_headers_.get() : 1628 override_response_headers_.get() :
1629 transaction_->GetResponseInfo()->headers.get(); 1629 transaction_->GetResponseInfo()->headers.get();
1630 } 1630 }
1631 1631
1632 void URLRequestHttpJob::NotifyURLRequestDestroyed() { 1632 void URLRequestHttpJob::NotifyURLRequestDestroyed() {
1633 awaiting_callback_ = false; 1633 awaiting_callback_ = false;
1634 } 1634 }
1635 1635
1636 } // namespace net 1636 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698