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..0f9b26dce99358a259d8ed553b94d0745adb0998 100644 |
--- a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.h |
+++ b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.h |
@@ -7,9 +7,10 @@ |
#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" |
+#include "wtf/Vector.h" |
#include <memory> |
@@ -123,6 +124,15 @@ class PLATFORM_EXPORT FeaturePolicy final { |
using FeatureList = const Vector<const FeaturePolicy::Feature*>; |
+ // Converts a list of JSON feature policy items into a mapping of features to |
+ // whitelists. For future compatibility, unrecognized features are simply |
+ // ignored, as are unparseable origins. 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* origin, |
+ Vector<String>* messages); |
+ |
static std::unique_ptr<FeaturePolicy> createFromParentPolicy( |
const FeaturePolicy* parent, |
RefPtr<SecurityOrigin>); |
@@ -130,7 +140,7 @@ class PLATFORM_EXPORT FeaturePolicy final { |
// 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); |
+ 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; |