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 "WebCommon.h" | 8 #include "WebCommon.h" |
9 #include "WebSecurityOrigin.h" | 9 #include "WebSecurityOrigin.h" |
10 #include "WebString.h" | 10 #include "WebString.h" |
11 #include "WebVector.h" | 11 #include "WebVector.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 // These values map to the features which can be controlled by Feature Policy. | 15 // These values map to the features which can be controlled by Feature Policy. |
16 // TODO(iclelland): Link to the spec where the behaviour for each of these is | 16 // TODO(iclelland): Link to the spec where the behaviour for each of these is |
17 // defined. | 17 // defined. |
18 enum class WebFeaturePolicyFeature { | 18 enum class WebFeaturePolicyFeature { |
19 NotFound = 0, | 19 NotFound = 0, |
20 // Controls access to video input devices. | |
21 Camera, | |
22 // Controls whether navigator.requestMediaKeySystemAccess is allowed. | |
23 Eme, | |
iclelland
2017/03/22 20:40:39
EncryptedMedia would be a more understandable name
| |
24 // Controls whether Element.requestFullscreen is allowed. | |
25 Fullscreen, | |
26 // Controls access to Geolocation interface. | |
27 Geolocation, | |
28 // Controls access to audio input devices. | |
29 Microphone, | |
30 // Controls access to requestMIDIAccess method. | |
31 MidiFeature, | |
32 // Controls access to PaymentRequest interface. | |
33 Payment, | |
34 // Controls access to audio output devices. | |
35 Speaker, | |
36 // Controls access to navigator.vibrate method. | |
37 Vibrate, | |
20 // Controls access to document.cookie attribute. | 38 // Controls access to document.cookie attribute. |
21 DocumentCookie, | 39 DocumentCookie, |
22 // Contols access to document.domain attribute. | 40 // Contols access to document.domain attribute. |
23 DocumentDomain, | 41 DocumentDomain, |
24 // Controls access to document.write and document.writeln methods. | 42 // Controls access to document.write and document.writeln methods. |
25 DocumentWrite, | 43 DocumentWrite, |
26 // Controls whether Element.requestFullscreen is allowed. | |
27 Fullscreen, | |
28 // Controls access to Geolocation interface. | |
29 Geolocation, | |
30 // Controls access to requestMIDIAccess method. | |
31 MidiFeature, | |
32 // Controls access to Notification interface. | 44 // Controls access to Notification interface. |
33 Notifications, | 45 Notifications, |
34 // Controls access to PaymentRequest interface. | |
35 Payment, | |
36 // Controls access to PushManager interface. | 46 // Controls access to PushManager interface. |
37 Push, | 47 Push, |
38 // Controls whether synchronous script elements will run. | 48 // Controls whether synchronous script elements will run. |
39 SyncScript, | 49 SyncScript, |
40 // Controls use of synchronous XMLHTTPRequest API. | 50 // Controls use of synchronous XMLHTTPRequest API. |
41 SyncXHR, | 51 SyncXHR, |
42 // Controls access to NavigatorUserMedia interface. | |
43 Usermedia, | |
44 // Controls access to navigator.vibrate method. | |
45 Vibrate, | |
46 // Controls access to RTCPeerConnection interface. | 52 // Controls access to RTCPeerConnection interface. |
47 WebRTC, | 53 WebRTC, |
48 LAST_FEATURE = WebRTC | 54 LAST_FEATURE = WebRTC |
49 }; | 55 }; |
50 | 56 |
51 struct BLINK_PLATFORM_EXPORT WebParsedFeaturePolicyDeclaration { | 57 struct BLINK_PLATFORM_EXPORT WebParsedFeaturePolicyDeclaration { |
52 WebParsedFeaturePolicyDeclaration() : matchesAllOrigins(false) {} | 58 WebParsedFeaturePolicyDeclaration() : matchesAllOrigins(false) {} |
53 WebFeaturePolicyFeature feature; | 59 WebFeaturePolicyFeature feature; |
54 bool matchesAllOrigins; | 60 bool matchesAllOrigins; |
55 WebVector<WebSecurityOrigin> origins; | 61 WebVector<WebSecurityOrigin> origins; |
(...skipping 10 matching lines...) Expand all Loading... | |
66 virtual ~WebFeaturePolicy() {} | 72 virtual ~WebFeaturePolicy() {} |
67 | 73 |
68 // Returns whether or not the given feature is enabled for the origin of the | 74 // Returns whether or not the given feature is enabled for the origin of the |
69 // document that owns the policy. | 75 // document that owns the policy. |
70 virtual bool IsFeatureEnabled(blink::WebFeaturePolicyFeature) const = 0; | 76 virtual bool IsFeatureEnabled(blink::WebFeaturePolicyFeature) const = 0; |
71 }; | 77 }; |
72 | 78 |
73 } // namespace blink | 79 } // namespace blink |
74 | 80 |
75 #endif // WebFeaturePolicy_h | 81 #endif // WebFeaturePolicy_h |
OLD | NEW |