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

Side by Side Diff: extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc

Issue 2655443003: Unify the "get" and "set" cookie access settings. (Closed)
Patch Set: fix android Created 3 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 "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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698