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

Unified Diff: third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.h

Issue 2655023004: Feature policy: Add basic algorithm for supporting frame policies. (Closed)
Patch Set: Addressing review comments 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: third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.h
diff --git a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.h b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.h
index f45ccd19961f77e3ec3c1ffe87149911e8663039..4ca4a9a7a7c1df5fc46c77bf636cbeea84b1329b 100644
--- a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.h
+++ b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.h
@@ -47,6 +47,25 @@ namespace blink {
// "*" refers to all origins; any origin will match a whitelist which contains
// it.
//
+// Declarations
+// ------------
+// A feature policy declaration is a mapping of a feature name to a whitelist.
+// A set of declarations is a declared policy.
+//
+// Inherited Policy
+// ----------------
+// In addition to the declared policy (which may be empty), every frame has
+// an inherited policy, which is determined by the context in which it is
+// embedded, or by the defaults for each feature in the case of the top-level
+// document.
+//
+// Container Policy
+// ----------------
+// A declared policy can be set on a specific frame by the embedding page using
+// the iframe "allow" attribute, or through attributes such as "allowfullscreen"
+// or "allowpaymentrequest". This is the container policy for the embedded
+// frame.
+//
// Defaults
// --------
// Each defined feature has a default policy, which determines whether the
@@ -139,6 +158,7 @@ class PLATFORM_EXPORT FeaturePolicy final {
static std::unique_ptr<FeaturePolicy> createFromParentPolicy(
const FeaturePolicy* parent,
+ const WebParsedFeaturePolicyHeader* containerPolicy,
RefPtr<SecurityOrigin>);
// Sets the declared policy from the parsed Feature-Policy HTTP header.
@@ -170,9 +190,15 @@ class PLATFORM_EXPORT FeaturePolicy final {
static std::unique_ptr<FeaturePolicy> createFromParentPolicy(
const FeaturePolicy* parent,
+ const WebParsedFeaturePolicyHeader* containerPolicy,
RefPtr<SecurityOrigin>,
FeatureList& features);
+ // Updates the inherited policy with the declarations from the iframe allow*
+ // attributes.
+ void addContainerPolicy(const WebParsedFeaturePolicyHeader* containerPolicy,
+ const FeaturePolicy* parent);
+
RefPtr<SecurityOrigin> m_origin;
// Records whether or not each feature was enabled for this frame by its

Powered by Google App Engine
This is Rietveld 408576698