Chromium Code Reviews| 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 struct WebFeaturePolicy { | 14 enum class WebFeaturePolicyFeature { |
| 15 struct ParsedWhitelist { | 15 NotFound = 0, |
| 16 ParsedWhitelist() : matchesAllOrigins(false) {} | 16 DocumentCookie, |
| 17 WebString featureName; | 17 DocumentDomain, |
| 18 bool matchesAllOrigins; | 18 DocumentWrite, |
| 19 WebVector<WebSecurityOrigin> origins; | 19 Geolocation, |
| 20 }; | 20 Fullscreen, |
| 21 MidiFeature, | |
| 22 Notifications, | |
| 23 Payment, | |
| 24 Push, | |
| 25 SyncScript, | |
| 26 SyncXHR, | |
| 27 Usermedia, | |
| 28 Vibrate, | |
| 29 WebRTC, | |
| 30 LAST_FEATURE = WebRTC | |
| 21 }; | 31 }; |
| 22 | 32 |
| 23 using WebParsedFeaturePolicy = WebVector<WebFeaturePolicy::ParsedWhitelist>; | 33 // Structure common to WebParsedFeature and WebParsedFeaturePolicyItem. |
| 34 struct WebParsedWhitelist { | |
| 35 WebParsedWhitelist() : matchesAllOrigins(false) {} | |
| 36 bool matchesAllOrigins; | |
| 37 WebVector<WebSecurityOrigin> origins; | |
| 38 }; | |
| 39 | |
| 40 // Composed policy for a specific feature. | |
| 41 struct WebParsedFeature { | |
|
raymes
2017/01/19 02:40:57
Is this class used anymore?
iclelland
2017/01/19 05:40:40
Looks like not; It was only used during the refact
| |
| 42 WebParsedFeature() : inherited(false) {} | |
| 43 WebString featureName; | |
| 44 bool inherited; | |
| 45 WebParsedWhitelist whitelist; | |
| 46 }; | |
| 47 | |
| 48 // Single item out of a declared header policy or iframe allow* attribute. | |
| 49 struct WebParsedFeaturePolicyDeclaration { | |
| 50 WebString featureName; | |
| 51 WebParsedWhitelist whitelist; | |
| 52 }; | |
| 53 | |
| 54 // Used in Blink code to represent parsed headers. Used for IPC between renderer | |
| 55 // and browser. | |
| 56 using WebParsedFeaturePolicyHeader = | |
| 57 WebVector<WebParsedFeaturePolicyDeclaration>; | |
| 58 | |
| 59 using WebParsedFeaturePolicy = WebVector<WebParsedFeature>; | |
| 60 | |
| 61 // Composed full policy for a document. Stored in SecurityContext for each | |
| 62 // document. This is essentially an opaque handle to an object in the embedder. | |
| 63 class WebFeaturePolicy { | |
| 64 public: | |
| 65 virtual ~WebFeaturePolicy() {} | |
| 66 }; | |
| 24 | 67 |
| 25 } // namespace blink | 68 } // namespace blink |
| 26 | 69 |
| 27 #endif // WebFeaturePolicy_h | 70 #endif // WebFeaturePolicy_h |
| OLD | NEW |