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

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

Issue 2651883008: Make content::FeaturePolicy implement WebFeaturePolicy, and use it in blink code (Closed)
Patch Set: Rebasing intensifies... Created 3 years, 10 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.h
diff --git a/content/common/feature_policy/feature_policy.h b/content/common/feature_policy/feature_policy.h
index fc156dd3b28ba1545ae887065aa581d12761cd23..d0c9ec95fc74c51db13407913a7f3cef85412966 100644
--- a/content/common/feature_policy/feature_policy.h
+++ b/content/common/feature_policy/feature_policy.h
@@ -103,7 +103,7 @@ struct CONTENT_EXPORT ParsedFeaturePolicyDeclaration {
using ParsedFeaturePolicyHeader = std::vector<ParsedFeaturePolicyDeclaration>;
-class CONTENT_EXPORT FeaturePolicy {
+class CONTENT_EXPORT FeaturePolicy : public blink::WebFeaturePolicy {
public:
// Represents a collection of origins which make up a whitelist in a feature
// policy. This collection may be set to match every origin (corresponding to
@@ -162,11 +162,11 @@ class CONTENT_EXPORT FeaturePolicy {
using FeatureList =
std::map<blink::WebFeaturePolicyFeature, const FeaturePolicy::Feature*>;
- ~FeaturePolicy();
+ ~FeaturePolicy() override;
static std::unique_ptr<FeaturePolicy> CreateFromParentPolicy(
const FeaturePolicy* parent_policy,
- const ParsedFeaturePolicyHeader* container_policy,
+ const ParsedFeaturePolicyHeader& container_policy,
const url::Origin& origin);
// Returns whether or not the given feature is enabled by this policy.
@@ -181,6 +181,8 @@ class CONTENT_EXPORT FeaturePolicy {
// Unrecognized features will be ignored.
void SetHeaderPolicy(const ParsedFeaturePolicyHeader& parsed_header);
+ void SetOrigin(url::Origin origin) { origin_ = origin; }
+
private:
friend class FeaturePolicyTest;
@@ -188,13 +190,13 @@ class CONTENT_EXPORT FeaturePolicy {
FeaturePolicy(url::Origin origin, const FeatureList& feature_list);
static std::unique_ptr<FeaturePolicy> CreateFromParentPolicy(
const FeaturePolicy* parent_policy,
- const ParsedFeaturePolicyHeader* container_policy,
+ const ParsedFeaturePolicyHeader& container_policy,
const url::Origin& origin,
const FeatureList& features);
// Updates the inherited policy with the declarations from the iframe allow*
// attributes.
- void AddContainerPolicy(const ParsedFeaturePolicyHeader* container_policy,
+ void AddContainerPolicy(const ParsedFeaturePolicyHeader& container_policy,
const FeaturePolicy* parent_policy);
// Returns the list of features which can be controlled by Feature Policy.

Powered by Google App Engine
This is Rietveld 408576698