| 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" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // Controls access to Notification interface. | 47 // Controls access to Notification interface. |
| 48 kNotifications, | 48 kNotifications, |
| 49 // Controls access to PushManager interface. | 49 // Controls access to PushManager interface. |
| 50 kPush, | 50 kPush, |
| 51 // Controls whether synchronous script elements will run. | 51 // Controls whether synchronous script elements will run. |
| 52 kSyncScript, | 52 kSyncScript, |
| 53 // Controls use of synchronous XMLHTTPRequest API. | 53 // Controls use of synchronous XMLHTTPRequest API. |
| 54 kSyncXHR, | 54 kSyncXHR, |
| 55 // Controls access to RTCPeerConnection interface. | 55 // Controls access to RTCPeerConnection interface. |
| 56 kWebRTC, | 56 kWebRTC, |
| 57 LAST_FEATURE = kWebRTC | 57 // Controls access to the WebUSB API. |
| 58 kUsb, |
| 59 LAST_FEATURE = kUsb |
| 58 }; | 60 }; |
| 59 | 61 |
| 60 struct BLINK_PLATFORM_EXPORT WebParsedFeaturePolicyDeclaration { | 62 struct BLINK_PLATFORM_EXPORT WebParsedFeaturePolicyDeclaration { |
| 61 WebParsedFeaturePolicyDeclaration() : matches_all_origins(false) {} | 63 WebParsedFeaturePolicyDeclaration() : matches_all_origins(false) {} |
| 62 WebFeaturePolicyFeature feature; | 64 WebFeaturePolicyFeature feature; |
| 63 bool matches_all_origins; | 65 bool matches_all_origins; |
| 64 WebVector<WebSecurityOrigin> origins; | 66 WebVector<WebSecurityOrigin> origins; |
| 65 }; | 67 }; |
| 66 | 68 |
| 67 // Used in Blink code to represent parsed headers. Used for IPC between renderer | 69 // Used in Blink code to represent parsed headers. Used for IPC between renderer |
| 68 // and browser. | 70 // and browser. |
| 69 using WebParsedFeaturePolicy = WebVector<WebParsedFeaturePolicyDeclaration>; | 71 using WebParsedFeaturePolicy = WebVector<WebParsedFeaturePolicyDeclaration>; |
| 70 | 72 |
| 71 // Composed full policy for a document. Stored in SecurityContext for each | 73 // Composed full policy for a document. Stored in SecurityContext for each |
| 72 // document. This is essentially an opaque handle to an object in the embedder. | 74 // document. This is essentially an opaque handle to an object in the embedder. |
| 73 class BLINK_PLATFORM_EXPORT WebFeaturePolicy { | 75 class BLINK_PLATFORM_EXPORT WebFeaturePolicy { |
| 74 public: | 76 public: |
| 75 virtual ~WebFeaturePolicy() {} | 77 virtual ~WebFeaturePolicy() {} |
| 76 | 78 |
| 77 // Returns whether or not the given feature is enabled for the origin of the | 79 // Returns whether or not the given feature is enabled for the origin of the |
| 78 // document that owns the policy. | 80 // document that owns the policy. |
| 79 virtual bool IsFeatureEnabled(blink::WebFeaturePolicyFeature) const = 0; | 81 virtual bool IsFeatureEnabled(blink::WebFeaturePolicyFeature) const = 0; |
| 80 }; | 82 }; |
| 81 | 83 |
| 82 } // namespace blink | 84 } // namespace blink |
| 83 | 85 |
| 84 #endif // WebFeaturePolicy_h | 86 #endif // WebFeaturePolicy_h |
| OLD | NEW |