| 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 "extensions/browser/api/declarative_webrequest/webrequest_condition_att
ribute.h" | 5 #include "extensions/browser/api/declarative_webrequest/webrequest_condition_att
ribute.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 } | 754 } |
| 755 | 755 |
| 756 bool WebRequestConditionAttributeThirdParty::IsFulfilled( | 756 bool WebRequestConditionAttributeThirdParty::IsFulfilled( |
| 757 const WebRequestData& request_data) const { | 757 const WebRequestData& request_data) const { |
| 758 if (!(request_data.stage & GetStages())) | 758 if (!(request_data.stage & GetStages())) |
| 759 return false; | 759 return false; |
| 760 | 760 |
| 761 // Request is "1st party" if it gets cookies under 3rd party-blocking policy. | 761 // Request is "1st party" if it gets cookies under 3rd party-blocking policy. |
| 762 const net::StaticCookiePolicy block_third_party_policy( | 762 const net::StaticCookiePolicy block_third_party_policy( |
| 763 net::StaticCookiePolicy::BLOCK_ALL_THIRD_PARTY_COOKIES); | 763 net::StaticCookiePolicy::BLOCK_ALL_THIRD_PARTY_COOKIES); |
| 764 const int can_get_cookies = block_third_party_policy.CanGetCookies( | 764 const int can_get_cookies = block_third_party_policy.CanAccessCookies( |
| 765 request_data.request->url(), | 765 request_data.request->url(), |
| 766 request_data.request->first_party_for_cookies()); | 766 request_data.request->first_party_for_cookies()); |
| 767 const bool is_first_party = (can_get_cookies == net::OK); | 767 const bool is_first_party = (can_get_cookies == net::OK); |
| 768 | 768 |
| 769 return match_third_party_ ? !is_first_party : is_first_party; | 769 return match_third_party_ ? !is_first_party : is_first_party; |
| 770 } | 770 } |
| 771 | 771 |
| 772 WebRequestConditionAttribute::Type | 772 WebRequestConditionAttribute::Type |
| 773 WebRequestConditionAttributeThirdParty::GetType() const { | 773 WebRequestConditionAttributeThirdParty::GetType() const { |
| 774 return CONDITION_THIRD_PARTY; | 774 return CONDITION_THIRD_PARTY; |
| 775 } | 775 } |
| 776 | 776 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 bool WebRequestConditionAttributeStages::Equals( | 875 bool WebRequestConditionAttributeStages::Equals( |
| 876 const WebRequestConditionAttribute* other) const { | 876 const WebRequestConditionAttribute* other) const { |
| 877 if (!WebRequestConditionAttribute::Equals(other)) | 877 if (!WebRequestConditionAttribute::Equals(other)) |
| 878 return false; | 878 return false; |
| 879 const WebRequestConditionAttributeStages* casted_other = | 879 const WebRequestConditionAttributeStages* casted_other = |
| 880 static_cast<const WebRequestConditionAttributeStages*>(other); | 880 static_cast<const WebRequestConditionAttributeStages*>(other); |
| 881 return allowed_stages_ == casted_other->allowed_stages_; | 881 return allowed_stages_ == casted_other->allowed_stages_; |
| 882 } | 882 } |
| 883 | 883 |
| 884 } // namespace extensions | 884 } // namespace extensions |
| OLD | NEW |