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

Unified Diff: content/common/feature_policy/feature_policy.h

Issue 2727803004: Replace string by enum in WebParsedFeaturePolicyDeclaration#feature (Closed)
Patch Set: Codereview: nit -- add comments to introduce features Created 3 years, 9 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: 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 86a4103c4ed1159d9cb023b6d5f92c13ce6e9a0d..9f3c2a1c17a29d1ea0a4ad38ab7d9f772c3137ed 100644
--- a/content/common/feature_policy/feature_policy.h
+++ b/content/common/feature_policy/feature_policy.h
@@ -33,9 +33,8 @@ namespace content {
//
// Features
// --------
-// Features which can be controlled by policy are defined by instances of the
-// FeaturePolicy::Feature struct. The features are referenced by the
-// |WebFeaturePolicyFeature| enum, declared in |WebFeaturePolicy.h|.
+// Features which can be controlled by policy are defined by instances of enum
+// blink::WebFeaturePolicyFeature, declared in |WebFeaturePolicy.h|.
//
// Whitelists
// ----------
@@ -90,13 +89,13 @@ namespace content {
// They exist only because we can't transfer WebVectors directly over IPC.
struct CONTENT_EXPORT ParsedFeaturePolicyDeclaration {
ParsedFeaturePolicyDeclaration();
- ParsedFeaturePolicyDeclaration(std::string feature_name,
+ ParsedFeaturePolicyDeclaration(blink::WebFeaturePolicyFeature feature,
bool matches_all_origins,
std::vector<url::Origin> origins);
ParsedFeaturePolicyDeclaration(const ParsedFeaturePolicyDeclaration& rhs);
~ParsedFeaturePolicyDeclaration();
- std::string feature_name;
+ blink::WebFeaturePolicyFeature feature;
bool matches_all_origins;
std::vector<url::Origin> origins;
};
@@ -148,20 +147,7 @@ class CONTENT_EXPORT FeaturePolicy : public blink::WebFeaturePolicy {
EnableForAll
};
- // The FeaturePolicy::Feature struct is used to define all features under
- // control of Feature Policy. There should only be one instance of this struct
- // for any given feature (declared below).
- struct Feature {
- // The name of the feature, as it should appear in a policy string
- const char* const feature_name;
-
- // Controls whether the feature should be available in the platform by
- // default, in the absence of any declared policy.
- FeatureDefault default_policy;
- };
-
- using FeatureList =
- std::map<blink::WebFeaturePolicyFeature, const FeaturePolicy::Feature*>;
+ using FeatureList = std::map<blink::WebFeaturePolicyFeature, FeatureDefault>;
~FeaturePolicy() override;
« no previous file with comments | « content/child/feature_policy/feature_policy_platform.cc ('k') | content/common/feature_policy/feature_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698