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

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

Issue 2099243002: PlzNavigate: properly set the initiator of the navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years 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 <vector> 7 #include <vector>
8 8
9 #include "base/base_switches.h" 9 #include "base/base_switches.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 CookieStore* cookie_store = request_->context()->cookie_store(); 680 CookieStore* cookie_store = request_->context()->cookie_store();
681 if (cookie_store && !(request_info_.load_flags & LOAD_DO_NOT_SEND_COOKIES)) { 681 if (cookie_store && !(request_info_.load_flags & LOAD_DO_NOT_SEND_COOKIES)) {
682 CookieOptions options; 682 CookieOptions options;
683 options.set_include_httponly(); 683 options.set_include_httponly();
684 684
685 // Set SameSiteCookieMode according to the rules laid out in 685 // Set SameSiteCookieMode according to the rules laid out in
686 // https://tools.ietf.org/html/draft-west-first-party-cookies: 686 // https://tools.ietf.org/html/draft-west-first-party-cookies:
687 // 687 //
688 // * Include both "strict" and "lax" same-site cookies if the request's 688 // * Include both "strict" and "lax" same-site cookies if the request's
689 // |url|, |initiator|, and |first_party_for_cookies| all have the same 689 // |url|, |initiator|, and |first_party_for_cookies| all have the same
690 // registrable domain. 690 // registrable domain. Note: this also covers the case of a request
691 // without an initiatore (only happens for browser-initiated main frame
nasko 2016/12/16 20:32:42 nit: initiator, no e needed at the end.
clamy 2016/12/21 14:54:19 Done.
692 // navigations).
691 // 693 //
692 // * Include only "lax" same-site cookies if the request's |URL| and 694 // * Include only "lax" same-site cookies if the request's |URL| and
693 // |first_party_for_cookies| have the same registrable domain, _and_ the 695 // |first_party_for_cookies| have the same registrable domain, _and_ the
694 // request's |method| is "safe" ("GET" or "HEAD"). 696 // request's |method| is "safe" ("GET" or "HEAD").
695 // 697 //
696 // Note that this will generally be the case only for cross-site requests 698 // Note that this will generally be the case only for cross-site requests
697 // which target a top-level browsing context. 699 // which target a top-level browsing context.
698 // 700 //
699 // * Otherwise, do not include same-site cookies. 701 // * Otherwise, do not include same-site cookies.
700 if (registry_controlled_domains::SameDomainOrHost( 702 if (registry_controlled_domains::SameDomainOrHost(
701 request_->url(), request_->first_party_for_cookies(), 703 request_->url(), request_->first_party_for_cookies(),
702 registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)) { 704 registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)) {
703 if (request_->initiator() && 705 if (!request_->initiator() ||
704 registry_controlled_domains::SameDomainOrHost( 706 registry_controlled_domains::SameDomainOrHost(
705 request_->url(), request_->initiator().value().GetURL(), 707 request_->url(), request_->initiator().value().GetURL(),
706 registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)) { 708 registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)) {
707 options.set_same_site_cookie_mode( 709 options.set_same_site_cookie_mode(
708 CookieOptions::SameSiteCookieMode::INCLUDE_STRICT_AND_LAX); 710 CookieOptions::SameSiteCookieMode::INCLUDE_STRICT_AND_LAX);
709 } else if (IsMethodSafe(request_->method())) { 711 } else if (IsMethodSafe(request_->method())) {
710 options.set_same_site_cookie_mode( 712 options.set_same_site_cookie_mode(
711 CookieOptions::SameSiteCookieMode::INCLUDE_LAX); 713 CookieOptions::SameSiteCookieMode::INCLUDE_LAX);
712 } 714 }
713 } 715 }
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
1554 awaiting_callback_ = false; 1556 awaiting_callback_ = false;
1555 1557
1556 // Notify NetworkQualityEstimator. 1558 // Notify NetworkQualityEstimator.
1557 NetworkQualityEstimator* network_quality_estimator = 1559 NetworkQualityEstimator* network_quality_estimator =
1558 request()->context()->network_quality_estimator(); 1560 request()->context()->network_quality_estimator();
1559 if (network_quality_estimator) 1561 if (network_quality_estimator)
1560 network_quality_estimator->NotifyURLRequestDestroyed(*request()); 1562 network_quality_estimator->NotifyURLRequestDestroyed(*request());
1561 } 1563 }
1562 1564
1563 } // namespace net 1565 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698