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 WebFeaturePolicy_h | 5 #ifndef WebFeaturePolicy_h |
6 #define WebFeaturePolicy_h | 6 #define WebFeaturePolicy_h |
7 | 7 |
8 #include "WebSecurityOrigin.h" | 8 #include "WebSecurityOrigin.h" |
9 #include "WebString.h" | 9 #include "WebString.h" |
10 #include "WebVector.h" | 10 #include "WebVector.h" |
11 #if INSIDE_BLINK | |
12 #include "wtf/HashSet.h" | |
13 #endif | |
11 | 14 |
12 namespace blink { | 15 namespace blink { |
13 | 16 |
14 struct WebFeaturePolicy { | 17 struct WebFeaturePolicy { |
15 struct ParsedWhitelist { | 18 struct ParsedWhitelist { |
16 ParsedWhitelist() : matchesAllOrigins(false) {} | 19 ParsedWhitelist() : matchesAllOrigins(false) {} |
17 WebString featureName; | 20 WebString featureName; |
18 bool matchesAllOrigins; | 21 bool matchesAllOrigins; |
19 WebVector<WebSecurityOrigin> origins; | 22 WebVector<WebSecurityOrigin> origins; |
20 }; | 23 }; |
21 }; | 24 }; |
22 | 25 |
23 using WebParsedFeaturePolicy = WebVector<WebFeaturePolicy::ParsedWhitelist>; | 26 using WebParsedFeaturePolicy = WebVector<WebFeaturePolicy::ParsedWhitelist>; |
24 | 27 |
28 enum class WebFeaturePolicyFeature { | |
Rick Byers
2017/02/09 20:59:59
iclelland is landing this now in https://coderevie
lunalu1
2017/02/09 23:19:04
Yeah, but I think it might be easier for me to lan
| |
29 NotFound = 0, | |
30 DocumentCookie, | |
31 DocumentDomain, | |
32 DocumentWrite, | |
33 Geolocation, | |
34 Fullscreen, | |
35 MidiFeature, | |
36 Notifications, | |
37 Payment, | |
38 Push, | |
39 SyncScript, | |
40 SyncXHR, | |
41 Usermedia, | |
42 Vibrate, | |
43 WebRTC, | |
44 LAST_FEATURE = WebRTC | |
45 }; | |
46 | |
25 } // namespace blink | 47 } // namespace blink |
26 | 48 |
49 #if INSIDE_BLINK | |
50 namespace WTF { | |
51 | |
52 template <> | |
53 struct DefaultHash<blink::WebFeaturePolicyFeature> { | |
54 STATIC_ONLY(DefaultHash); | |
55 using Hash = IntHash<blink::WebFeaturePolicyFeature>; | |
56 }; | |
57 | |
58 template <> | |
59 struct HashTraits<blink::WebFeaturePolicyFeature> | |
60 : GenericHashTraits<blink::WebFeaturePolicyFeature> { | |
61 STATIC_ONLY(HashTraits); | |
62 static bool isDeletedValue(const blink::WebFeaturePolicyFeature& value) { | |
63 return value == static_cast<blink::WebFeaturePolicyFeature>(-1); | |
64 } | |
65 static void constructDeletedValue(blink::WebFeaturePolicyFeature& slot, | |
66 bool) { | |
67 slot = static_cast<blink::WebFeaturePolicyFeature>(-1); | |
68 } | |
69 }; | |
70 | |
71 } // namespace WTF | |
72 #endif | |
73 | |
27 #endif // WebFeaturePolicy_h | 74 #endif // WebFeaturePolicy_h |
OLD | NEW |