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

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

Issue 1253353004: WIP: Teach "First-Party-Only" cookies about the requestor origin. Base URL: https://chromium.googlesource.com/chromium/src.git@cookie-options
Patch Set: Created 5 years, 4 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
« no previous file with comments | « net/url_request/url_request.cc ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 } 652 }
653 } 653 }
654 654
655 void URLRequestHttpJob::DoLoadCookies() { 655 void URLRequestHttpJob::DoLoadCookies() {
656 CookieOptions options; 656 CookieOptions options;
657 options.set_include_httponly(); 657 options.set_include_httponly();
658 658
659 // TODO(mkwst): Drop this `if` once we decide whether or not to ship 659 // TODO(mkwst): Drop this `if` once we decide whether or not to ship
660 // first-party cookies: https://crbug.com/459154 660 // first-party cookies: https://crbug.com/459154
661 if (network_delegate() && 661 if (network_delegate() &&
662 network_delegate()->FirstPartyOnlyCookieExperimentEnabled()) 662 network_delegate()->FirstPartyOnlyCookieExperimentEnabled()) {
663 options.set_first_party_url(request_->first_party_for_cookies()); 663 options.set_first_party_url(request_->first_party_for_cookies());
664 else 664 options.set_requestor_origin(request_->requestor_origin());
665 } else {
665 options.set_include_first_party_only(); 666 options.set_include_first_party_only();
667 }
666 668
667 request_->context()->cookie_store()->GetCookiesWithOptionsAsync( 669 request_->context()->cookie_store()->GetCookiesWithOptionsAsync(
668 request_->url(), options, base::Bind(&URLRequestHttpJob::OnCookiesLoaded, 670 request_->url(), options, base::Bind(&URLRequestHttpJob::OnCookiesLoaded,
669 weak_factory_.GetWeakPtr())); 671 weak_factory_.GetWeakPtr()));
670 } 672 }
671 673
672 void URLRequestHttpJob::CheckCookiePolicyAndLoad( 674 void URLRequestHttpJob::CheckCookiePolicyAndLoad(
673 const CookieList& cookie_list) { 675 const CookieList& cookie_list) {
674 if (CanGetCookies(cookie_list)) 676 if (CanGetCookies(cookie_list))
675 DoLoadCookies(); 677 DoLoadCookies();
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
1552 return override_response_headers_.get() ? 1554 return override_response_headers_.get() ?
1553 override_response_headers_.get() : 1555 override_response_headers_.get() :
1554 transaction_->GetResponseInfo()->headers.get(); 1556 transaction_->GetResponseInfo()->headers.get();
1555 } 1557 }
1556 1558
1557 void URLRequestHttpJob::NotifyURLRequestDestroyed() { 1559 void URLRequestHttpJob::NotifyURLRequestDestroyed() {
1558 awaiting_callback_ = false; 1560 awaiting_callback_ = false;
1559 } 1561 }
1560 1562
1561 } // namespace net 1563 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request.cc ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698