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 b73ee051f93638fc155300776afc08d881ab8afe..abf5c95af19d6efa6176ac2444fe3d19b3c144cb 100644 |
--- a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.h |
+++ b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.h |
@@ -7,6 +7,7 @@ |
#include "platform/PlatformExport.h" |
#include "platform/weborigin/SecurityOrigin.h" |
+#include "public/platform/WebFeaturePolicy.h" |
#include "wtf/RefPtr.h" |
#include "wtf/Vector.h" |
#include "wtf/text/WTFString.h" |
@@ -123,14 +124,23 @@ class PLATFORM_EXPORT FeaturePolicy final { |
using FeatureList = const Vector<const FeaturePolicy::Feature*>; |
+ // Converts a JSON feature policy string into a vector of whitelists, one for |
+ // each feature specified. Unrecognized features are parsed and included |
+ // but will be filtered out when the policy is constructed. If |messages| is |
+ // not null, then any errors in the input will cause an error message to be |
+ // appended to it. |
+ static WebVector<WebFeaturePolicy::ParsedWhitelist> parseFeaturePolicy( |
+ const String& policy, |
+ const SecurityOrigin*, |
+ Vector<String>* messages); |
+ |
static std::unique_ptr<FeaturePolicy> createFromParentPolicy( |
const FeaturePolicy* parent, |
RefPtr<SecurityOrigin>); |
- // Sets the declared policy from the Feature-Policy HTTP header. If the header |
- // cannot be parsed, errors will be appended to the |messages| vector, if not |
- // null. |
- void setHeaderPolicy(const String&, Vector<String>* messages); |
+ // Sets the declared policy from the parsed Feature-Policy HTTP header. |
+ // Unrecognized features will be ignored. |
+ void setHeaderPolicy(const WebVector<WebFeaturePolicy::ParsedWhitelist>&); |
// Returns whether or not the given feature is enabled by this policy. |
bool isFeatureEnabledForOrigin(const Feature&, const SecurityOrigin&) const; |