Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef FeaturePolicy_h | 5 #ifndef FeaturePolicy_h |
| 6 #define FeaturePolicy_h | 6 #define FeaturePolicy_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/weborigin/SecurityOrigin.h" | 9 #include "platform/weborigin/SecurityOrigin.h" |
| 10 #include "platform/wtf/HashMap.h" | |
| 10 #include "platform/wtf/RefPtr.h" | 11 #include "platform/wtf/RefPtr.h" |
| 11 #include "platform/wtf/Vector.h" | 12 #include "platform/wtf/Vector.h" |
| 13 #include "platform/wtf/text/StringHash.h" | |
| 12 #include "platform/wtf/text/WTFString.h" | 14 #include "platform/wtf/text/WTFString.h" |
| 13 #include "public/platform/WebFeaturePolicy.h" | 15 #include "public/platform/WebFeaturePolicy.h" |
| 14 | 16 |
| 15 #include <memory> | 17 #include <memory> |
| 16 | 18 |
| 17 namespace blink { | 19 namespace blink { |
| 18 | 20 |
| 19 // Returns the corresponding WebFeaturePolicyFeature enum given a feature | 21 // Returns a map between feature name (string) and WebFeaturePolicyFeature |
| 20 // string. | 22 // (enum). |
| 21 PLATFORM_EXPORT WebFeaturePolicyFeature | 23 typedef HashMap<String, WebFeaturePolicyFeature> FeatureNameMap; |
| 22 GetWebFeaturePolicyFeature(const String& feature); | 24 PLATFORM_EXPORT const FeatureNameMap& GetDefaultFeatureNameMap(); |
| 23 | 25 |
| 24 // Converts a JSON feature policy string into a vector of whitelists, one for | 26 // Converts a JSON feature policy string into a vector of whitelists, one for |
| 25 // each feature specified. Unrecognized features are filtered out. If |messages| | 27 // each feature specified. Unrecognized features are filtered out. If |messages| |
| 26 // is not null, then any errors in the input will cause an error message to be | 28 // is not null, then any errors in the input will cause an error message to be |
| 27 // appended to it. | 29 // appended to it. |
| 28 PLATFORM_EXPORT WebParsedFeaturePolicy | 30 PLATFORM_EXPORT WebParsedFeaturePolicy |
| 29 ParseFeaturePolicy(const String& policy, | 31 ParseFeaturePolicy(const String& policy, |
| 30 RefPtr<SecurityOrigin>, | 32 RefPtr<SecurityOrigin>, |
| 31 Vector<String>* messages); | 33 Vector<String>* messages); |
| 32 | 34 |
| 35 PLATFORM_EXPORT WebParsedFeaturePolicy | |
|
iclelland
2017/04/19 17:23:28
Can you add a comment here that this version with
| |
| 36 ParseFeaturePolicy(const String& policy, | |
| 37 RefPtr<SecurityOrigin>, | |
| 38 Vector<String>* messages, | |
| 39 const FeatureNameMap& feature_names); | |
| 40 | |
| 33 // Given a vector of WebFeaturePolicyFeatures and an origin, creates a vector of | 41 // Given a vector of WebFeaturePolicyFeatures and an origin, creates a vector of |
| 34 // whitelists, one for each feature specified. | 42 // whitelists, one for each feature specified. |
| 35 PLATFORM_EXPORT WebParsedFeaturePolicy GetContainerPolicyFromAllowedFeatures( | 43 PLATFORM_EXPORT WebParsedFeaturePolicy GetContainerPolicyFromAllowedFeatures( |
| 36 const WebVector<WebFeaturePolicyFeature>& features, | 44 const WebVector<WebFeaturePolicyFeature>& features, |
| 37 RefPtr<SecurityOrigin>); | 45 RefPtr<SecurityOrigin>); |
| 38 | 46 |
| 39 } // namespace blink | 47 } // namespace blink |
| 40 | 48 |
| 41 #endif // FeaturePolicy_h | 49 #endif // FeaturePolicy_h |
| OLD | NEW |