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 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
| 14 // These values map to the features which can be controlled by Feature Policy. |
| 15 // TODO(iclelland): Link to the spec where the behaviour for each of these is |
| 16 // defined. |
| 17 enum class WebFeaturePolicyFeature { |
| 18 NotFound = 0, |
| 19 // Controls access to document.cookie attribute. |
| 20 DocumentCookie, |
| 21 // Contols access to document.domain attribute. |
| 22 DocumentDomain, |
| 23 // Controls access to document.write and document.writeln methods. |
| 24 DocumentWrite, |
| 25 // Controls whether Element.requestFullscreen is allowed. |
| 26 Fullscreen, |
| 27 // Controls access to Geolocation interface. |
| 28 Geolocation, |
| 29 // Controls access to requestMIDIAccess method. |
| 30 MidiFeature, |
| 31 // Controls access to Notification interface. |
| 32 Notifications, |
| 33 // Controls access to PaymentRequest interface. |
| 34 Payment, |
| 35 // Controls access to PushManager interface. |
| 36 Push, |
| 37 // Controls whether synchronous script elements will run. |
| 38 SyncScript, |
| 39 // Controls use of synchronous XMLHTTPRequest API. |
| 40 SyncXHR, |
| 41 // Controls access to NavigatorUserMedia interface. |
| 42 Usermedia, |
| 43 // Controls access to navigator.vibrate method. |
| 44 Vibrate, |
| 45 // Controls access to RTCPeerConnection interface. |
| 46 WebRTC, |
| 47 LAST_FEATURE = WebRTC |
| 48 }; |
| 49 |
14 struct WebParsedFeaturePolicyDeclaration { | 50 struct WebParsedFeaturePolicyDeclaration { |
15 WebParsedFeaturePolicyDeclaration() : matchesAllOrigins(false) {} | 51 WebParsedFeaturePolicyDeclaration() : matchesAllOrigins(false) {} |
16 WebString featureName; | 52 WebString featureName; |
17 bool matchesAllOrigins; | 53 bool matchesAllOrigins; |
18 WebVector<WebSecurityOrigin> origins; | 54 WebVector<WebSecurityOrigin> origins; |
19 }; | 55 }; |
20 | 56 |
21 // Used in Blink code to represent parsed headers. Used for IPC between renderer | 57 // Used in Blink code to represent parsed headers. Used for IPC between renderer |
22 // and browser. | 58 // and browser. |
23 using WebParsedFeaturePolicyHeader = | 59 using WebParsedFeaturePolicyHeader = |
24 WebVector<WebParsedFeaturePolicyDeclaration>; | 60 WebVector<WebParsedFeaturePolicyDeclaration>; |
25 | 61 |
26 } // namespace blink | 62 } // namespace blink |
27 | 63 |
28 #endif // WebFeaturePolicy_h | 64 #endif // WebFeaturePolicy_h |
OLD | NEW |