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 #include "platform/feature_policy/FeaturePolicy.h" | 5 #include "platform/feature_policy/FeaturePolicy.h" |
6 | 6 |
7 #include "platform/RuntimeEnabledFeatures.h" | 7 #include "platform/RuntimeEnabledFeatures.h" |
8 #include "platform/json/JSONValues.h" | 8 #include "platform/json/JSONValues.h" |
9 #include "platform/network/HTTPParsers.h" | 9 #include "platform/network/HTTPParsers.h" |
10 #include "platform/weborigin/SecurityOrigin.h" | 10 #include "platform/weborigin/SecurityOrigin.h" |
11 #include "wtf/PtrUtil.h" | 11 #include "wtf/PtrUtil.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 WebFeaturePolicyFeature getWebFeaturePolicyFeature(const String& feature) { | 15 WebFeaturePolicyFeature getWebFeaturePolicyFeature(const String& feature) { |
16 if (feature == "fullscreen") | 16 if (feature == "fullscreen") |
17 return WebFeaturePolicyFeature::Fullscreen; | 17 return WebFeaturePolicyFeature::Fullscreen; |
18 if (feature == "payment") | 18 if (feature == "payment") |
19 return WebFeaturePolicyFeature::Payment; | 19 return WebFeaturePolicyFeature::Payment; |
20 if (feature == "vibrate") | 20 if (feature == "vibrate") |
21 return WebFeaturePolicyFeature::Vibrate; | 21 return WebFeaturePolicyFeature::Vibrate; |
22 if (feature == "usermedia") | |
23 return WebFeaturePolicyFeature::Usermedia; | |
24 if (RuntimeEnabledFeatures::featurePolicyExperimentalFeaturesEnabled()) { | 22 if (RuntimeEnabledFeatures::featurePolicyExperimentalFeaturesEnabled()) { |
| 23 if (feature == "camera") |
| 24 return WebFeaturePolicyFeature::Camera; |
| 25 if (feature == "eme") |
| 26 return WebFeaturePolicyFeature::Eme; |
| 27 if (feature == "microphone") |
| 28 return WebFeaturePolicyFeature::Microphone; |
| 29 if (feature == "speaker") |
| 30 return WebFeaturePolicyFeature::Speaker; |
25 if (feature == "cookie") | 31 if (feature == "cookie") |
26 return WebFeaturePolicyFeature::DocumentCookie; | 32 return WebFeaturePolicyFeature::DocumentCookie; |
27 if (feature == "domain") | 33 if (feature == "domain") |
28 return WebFeaturePolicyFeature::DocumentDomain; | 34 return WebFeaturePolicyFeature::DocumentDomain; |
29 if (feature == "docwrite") | 35 if (feature == "docwrite") |
30 return WebFeaturePolicyFeature::DocumentWrite; | 36 return WebFeaturePolicyFeature::DocumentWrite; |
31 if (feature == "geolocation") | 37 if (feature == "geolocation") |
32 return WebFeaturePolicyFeature::Geolocation; | 38 return WebFeaturePolicyFeature::Geolocation; |
33 if (feature == "midi") | 39 if (feature == "midi") |
34 return WebFeaturePolicyFeature::MidiFeature; | 40 return WebFeaturePolicyFeature::MidiFeature; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 for (const WebFeaturePolicyFeature feature : features) { | 125 for (const WebFeaturePolicyFeature feature : features) { |
120 WebParsedFeaturePolicyDeclaration whitelist; | 126 WebParsedFeaturePolicyDeclaration whitelist; |
121 whitelist.feature = feature; | 127 whitelist.feature = feature; |
122 whitelist.origins = Vector<WebSecurityOrigin>(1UL, {origin}); | 128 whitelist.origins = Vector<WebSecurityOrigin>(1UL, {origin}); |
123 whitelists.push_back(whitelist); | 129 whitelists.push_back(whitelist); |
124 } | 130 } |
125 return whitelists; | 131 return whitelists; |
126 } | 132 } |
127 | 133 |
128 } // namespace blink | 134 } // namespace blink |
OLD | NEW |