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..86a4103c4ed1159d9cb023b6d5f92c13ce6e9a0d 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 |
@@ -112,6 +112,7 @@ class CONTENT_EXPORT FeaturePolicy { |
class Whitelist final { |
public: |
Whitelist(); |
+ Whitelist(const Whitelist& rhs); |
~Whitelist(); |
// Adds a single origin to the whitelist. |
@@ -162,21 +163,25 @@ 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. |
+ static std::unique_ptr<FeaturePolicy> CreateFromPolicyWithOrigin( |
+ const FeaturePolicy& policy, |
+ const url::Origin& origin); |
+ |
+ // WebFeaturePolicy implementation |
+ bool IsFeatureEnabled(blink::WebFeaturePolicyFeature feature) const override; |
+ |
+ // Returns whether or not the given feature is enabled by this policy for a |
+ // specific origin. |
bool IsFeatureEnabledForOrigin(blink::WebFeaturePolicyFeature feature, |
const url::Origin& origin) const; |
- // Returns whether or not the given feature is enabled for the origin of the |
- // document that owns the policy. |
- bool IsFeatureEnabled(blink::WebFeaturePolicyFeature feature) const; |
- |
// Sets the declared policy from the parsed Feature-Policy HTTP header. |
// Unrecognized features will be ignored. |
void SetHeaderPolicy(const ParsedFeaturePolicyHeader& parsed_header); |
@@ -188,13 +193,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. |