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

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

Issue 2727803004: Replace string by enum in WebParsedFeaturePolicyDeclaration#feature (Closed)
Patch Set: Codereview: nit 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..04d9c3b3eba527c7393db0969fc8b91e799cd24f 100644
--- a/content/common/feature_policy/feature_policy.h
+++ b/content/common/feature_policy/feature_policy.h
@@ -31,12 +31,6 @@ namespace content {
//
// Key concepts:
//
-// Features
nasko 2017/03/17 16:35:56 nit: I don't understand why this section is remove
lunalu1 2017/03/17 18:52:55 My bad, I will add it back.
-// --------
-// 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|.
-//
// Whitelists
// ----------
// Whitelists are collections of origins, although two special terms can be used
@@ -90,13 +84,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 +142,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