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

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: Tests. 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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 weak_factory_.GetWeakPtr())); 672 weak_factory_.GetWeakPtr()));
673 } else { 673 } else {
674 DoStartTransaction(); 674 DoStartTransaction();
675 } 675 }
676 } 676 }
677 677
678 void URLRequestHttpJob::DoLoadCookies() { 678 void URLRequestHttpJob::DoLoadCookies() {
679 CookieOptions options; 679 CookieOptions options;
680 options.set_include_httponly(); 680 options.set_include_httponly();
681 681
682 // TODO(mkwst): If first-party-only cookies aren't enabled, pretend the 682 // TODO(mkwst): If same-site cookies aren't enabled, pretend the request is
683 // request is first-party regardless, in order to include all cookies. Drop 683 // same-site regardless, in order to include all cookies. Drop this check once
684 // this check once we decide whether or not we're shipping this feature: 684 // we decide whether or not we're shipping this feature:
685 // https://crbug.com/459154 685 // https://crbug.com/459154
686 url::Origin requested_origin(request_->url()); 686 url::Origin requested_origin(request_->url());
687 if (!network_delegate() || 687 if (!network_delegate() ||
688 !network_delegate()->AreExperimentalCookieFeaturesEnabled()) { 688 !network_delegate()->AreExperimentalCookieFeaturesEnabled()) {
689 options.set_include_first_party_only_cookies(); 689 options.set_include_same_site();
690 } else if (requested_origin.IsSameOriginWith( 690 } else if (requested_origin.IsSameOriginWith(
691 url::Origin(request_->first_party_for_cookies())) && 691 url::Origin(request_->first_party_for_cookies())) &&
692 (IsMethodSafe(request_->method()) || 692 (IsMethodSafe(request_->method()) ||
693 requested_origin.IsSameOriginWith(request_->initiator()))) { 693 requested_origin.IsSameOriginWith(request_->initiator()))) {
694 options.set_include_first_party_only_cookies(); 694 options.set_include_same_site();
695 } 695 }
696 696
697 request_->context()->cookie_store()->GetCookiesWithOptionsAsync( 697 request_->context()->cookie_store()->GetCookiesWithOptionsAsync(
698 request_->url(), options, base::Bind(&URLRequestHttpJob::OnCookiesLoaded, 698 request_->url(), options, base::Bind(&URLRequestHttpJob::OnCookiesLoaded,
699 weak_factory_.GetWeakPtr())); 699 weak_factory_.GetWeakPtr()));
700 } 700 }
701 701
702 void URLRequestHttpJob::CheckCookiePolicyAndLoad( 702 void URLRequestHttpJob::CheckCookiePolicyAndLoad(
703 const CookieList& cookie_list) { 703 const CookieList& cookie_list) {
704 if (CanGetCookies(cookie_list)) 704 if (CanGetCookies(cookie_list))
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
1606 return override_response_headers_.get() ? 1606 return override_response_headers_.get() ?
1607 override_response_headers_.get() : 1607 override_response_headers_.get() :
1608 transaction_->GetResponseInfo()->headers.get(); 1608 transaction_->GetResponseInfo()->headers.get();
1609 } 1609 }
1610 1610
1611 void URLRequestHttpJob::NotifyURLRequestDestroyed() { 1611 void URLRequestHttpJob::NotifyURLRequestDestroyed() {
1612 awaiting_callback_ = false; 1612 awaiting_callback_ = false;
1613 } 1613 }
1614 1614
1615 } // namespace net 1615 } // namespace net
OLDNEW
« no previous file with comments | « net/extras/sqlite/sqlite_persistent_cookie_store.cc ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698