| 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 <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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 // registrable domain. | 682 // registrable domain. |
| 683 // | 683 // |
| 684 // * Include only "lax" same-site cookies if the request's |URL| and | 684 // * Include only "lax" same-site cookies if the request's |URL| and |
| 685 // |first_party_for_cookies| have the same registrable domain, _and_ the | 685 // |first_party_for_cookies| have the same registrable domain, _and_ the |
| 686 // request's |method| is "safe" ("GET" or "HEAD"). | 686 // request's |method| is "safe" ("GET" or "HEAD"). |
| 687 // | 687 // |
| 688 // Note that this will generally be the case only for cross-site requests | 688 // Note that this will generally be the case only for cross-site requests |
| 689 // which target a top-level browsing context. | 689 // which target a top-level browsing context. |
| 690 // | 690 // |
| 691 // * Otherwise, do not include same-site cookies. | 691 // * Otherwise, do not include same-site cookies. |
| 692 url::Origin requested_origin(request_->url()); | |
| 693 url::Origin site_for_cookies(request_->first_party_for_cookies()); | |
| 694 | |
| 695 if (registry_controlled_domains::SameDomainOrHost( | 692 if (registry_controlled_domains::SameDomainOrHost( |
| 696 requested_origin, site_for_cookies, | 693 request_->url(), request_->first_party_for_cookies(), |
| 697 registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)) { | 694 registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)) { |
| 698 if (registry_controlled_domains::SameDomainOrHost( | 695 if (request_->initiator() && |
| 699 requested_origin, request_->initiator(), | 696 registry_controlled_domains::SameDomainOrHost( |
| 697 request_->url(), request_->initiator().value().GetURL(), |
| 700 registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)) { | 698 registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)) { |
| 701 options.set_same_site_cookie_mode( | 699 options.set_same_site_cookie_mode( |
| 702 CookieOptions::SameSiteCookieMode::INCLUDE_STRICT_AND_LAX); | 700 CookieOptions::SameSiteCookieMode::INCLUDE_STRICT_AND_LAX); |
| 703 } else if (IsMethodSafe(request_->method())) { | 701 } else if (IsMethodSafe(request_->method())) { |
| 704 options.set_same_site_cookie_mode( | 702 options.set_same_site_cookie_mode( |
| 705 CookieOptions::SameSiteCookieMode::INCLUDE_LAX); | 703 CookieOptions::SameSiteCookieMode::INCLUDE_LAX); |
| 706 } | 704 } |
| 707 } | 705 } |
| 708 | 706 |
| 709 cookie_store->GetCookieListWithOptionsAsync( | 707 cookie_store->GetCookieListWithOptionsAsync( |
| (...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 awaiting_callback_ = false; | 1539 awaiting_callback_ = false; |
| 1542 | 1540 |
| 1543 // Notify NetworkQualityEstimator. | 1541 // Notify NetworkQualityEstimator. |
| 1544 NetworkQualityEstimator* network_quality_estimator = | 1542 NetworkQualityEstimator* network_quality_estimator = |
| 1545 request()->context()->network_quality_estimator(); | 1543 request()->context()->network_quality_estimator(); |
| 1546 if (network_quality_estimator) | 1544 if (network_quality_estimator) |
| 1547 network_quality_estimator->NotifyURLRequestDestroyed(*request()); | 1545 network_quality_estimator->NotifyURLRequestDestroyed(*request()); |
| 1548 } | 1546 } |
| 1549 | 1547 |
| 1550 } // namespace net | 1548 } // namespace net |
| OLD | NEW |