| 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 // |
| 17 // defined. | 17 // Features are defined in |
| 18 // https://wicg.github.io/feature-policy/#defined-features. Many of these are |
| 19 // still under development in blink behind the featurePolicyExperimentalFeatures |
| 20 // flag, see getWebFeaturePolicyFeature(). |
| 18 enum class WebFeaturePolicyFeature { | 21 enum class WebFeaturePolicyFeature { |
| 19 NotFound = 0, | 22 NotFound = 0, |
| 23 // Controls access to video input devices. |
| 24 Camera, |
| 25 // Controls whether navigator.requestMediaKeySystemAccess is allowed. |
| 26 Eme, |
| 27 // Controls whether Element.requestFullscreen is allowed. |
| 28 Fullscreen, |
| 29 // Controls access to Geolocation interface. |
| 30 Geolocation, |
| 31 // Controls access to audio input devices. |
| 32 Microphone, |
| 33 // Controls access to requestMIDIAccess method. |
| 34 MidiFeature, |
| 35 // Controls access to PaymentRequest interface. |
| 36 Payment, |
| 37 // Controls access to audio output devices. |
| 38 Speaker, |
| 39 // Controls access to navigator.vibrate method. |
| 40 Vibrate, |
| 20 // Controls access to document.cookie attribute. | 41 // Controls access to document.cookie attribute. |
| 21 DocumentCookie, | 42 DocumentCookie, |
| 22 // Contols access to document.domain attribute. | 43 // Contols access to document.domain attribute. |
| 23 DocumentDomain, | 44 DocumentDomain, |
| 24 // Controls access to document.write and document.writeln methods. | 45 // Controls access to document.write and document.writeln methods. |
| 25 DocumentWrite, | 46 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. | 47 // Controls access to Notification interface. |
| 33 Notifications, | 48 Notifications, |
| 34 // Controls access to PaymentRequest interface. | |
| 35 Payment, | |
| 36 // Controls access to PushManager interface. | 49 // Controls access to PushManager interface. |
| 37 Push, | 50 Push, |
| 38 // Controls whether synchronous script elements will run. | 51 // Controls whether synchronous script elements will run. |
| 39 SyncScript, | 52 SyncScript, |
| 40 // Controls use of synchronous XMLHTTPRequest API. | 53 // Controls use of synchronous XMLHTTPRequest API. |
| 41 SyncXHR, | 54 SyncXHR, |
| 42 // Controls access to NavigatorUserMedia interface. | |
| 43 Usermedia, | |
| 44 // Controls access to navigator.vibrate method. | |
| 45 Vibrate, | |
| 46 // Controls access to RTCPeerConnection interface. | 55 // Controls access to RTCPeerConnection interface. |
| 47 WebRTC, | 56 WebRTC, |
| 48 LAST_FEATURE = WebRTC | 57 LAST_FEATURE = WebRTC |
| 49 }; | 58 }; |
| 50 | 59 |
| 51 struct BLINK_PLATFORM_EXPORT WebParsedFeaturePolicyDeclaration { | 60 struct BLINK_PLATFORM_EXPORT WebParsedFeaturePolicyDeclaration { |
| 52 WebParsedFeaturePolicyDeclaration() : matchesAllOrigins(false) {} | 61 WebParsedFeaturePolicyDeclaration() : matchesAllOrigins(false) {} |
| 53 WebFeaturePolicyFeature feature; | 62 WebFeaturePolicyFeature feature; |
| 54 bool matchesAllOrigins; | 63 bool matchesAllOrigins; |
| 55 WebVector<WebSecurityOrigin> origins; | 64 WebVector<WebSecurityOrigin> origins; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 66 virtual ~WebFeaturePolicy() {} | 75 virtual ~WebFeaturePolicy() {} |
| 67 | 76 |
| 68 // Returns whether or not the given feature is enabled for the origin of the | 77 // Returns whether or not the given feature is enabled for the origin of the |
| 69 // document that owns the policy. | 78 // document that owns the policy. |
| 70 virtual bool IsFeatureEnabled(blink::WebFeaturePolicyFeature) const = 0; | 79 virtual bool IsFeatureEnabled(blink::WebFeaturePolicyFeature) const = 0; |
| 71 }; | 80 }; |
| 72 | 81 |
| 73 } // namespace blink | 82 } // namespace blink |
| 74 | 83 |
| 75 #endif // WebFeaturePolicy_h | 84 #endif // WebFeaturePolicy_h |
| OLD | NEW |