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

Unified Diff: content/common/feature_policy/feature_policy.cc

Issue 2797813002: Replicate feature policy container policies. (Closed)
Patch Set: Cleanup, reponding to review comments Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/common/feature_policy/feature_policy.cc
diff --git a/content/common/feature_policy/feature_policy.cc b/content/common/feature_policy/feature_policy.cc
index 9494574587d983312b0292d6019f3fd970d01713..96a92cbc6920ca1fd7c21c4beec5f426f42a8b4e 100644
--- a/content/common/feature_policy/feature_policy.cc
+++ b/content/common/feature_policy/feature_policy.cc
@@ -42,6 +42,12 @@ ParsedFeaturePolicyDeclaration::ParsedFeaturePolicyDeclaration(
ParsedFeaturePolicyDeclaration::~ParsedFeaturePolicyDeclaration() {}
+bool operator==(const ParsedFeaturePolicyDeclaration& lhs,
+ const ParsedFeaturePolicyDeclaration& rhs) {
+ return std::tie(lhs.feature, lhs.matches_all_origins, lhs.origins) ==
+ std::tie(rhs.feature, rhs.matches_all_origins, rhs.origins);
lunalu1 2017/04/05 22:30:03 If lhs.origins = [a.com, b.com, c.com], rhs.origin
alexmos 2017/04/11 01:17:49 +1, just bumping this up to ensure we don't forget
iclelland 2017/04/11 17:41:43 I think that the reason may have just been that ve
+}
+
FeaturePolicy::Whitelist::Whitelist() : matches_all_origins_(false) {}
FeaturePolicy::Whitelist::Whitelist(const Whitelist& rhs) = default;
@@ -112,9 +118,8 @@ bool FeaturePolicy::IsFeatureEnabledForOrigin(
auto whitelist = whitelists_.find(feature);
if (whitelist != whitelists_.end())
return whitelist->second->Contains(origin);
- if (default_policy == FeaturePolicy::FeatureDefault::EnableForAll) {
+ if (default_policy == FeaturePolicy::FeatureDefault::EnableForAll)
return true;
- }
if (default_policy == FeaturePolicy::FeatureDefault::EnableForSelf) {
// TODO(iclelland): Remove the pointer equality check once it is possible to
// compare opaque origins successfully against themselves.

Powered by Google App Engine
This is Rietveld 408576698