| 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 #if INSIDE_BLINK |
| 12 #include "wtf/HashSet.h" |
| 13 #endif |
| 11 | 14 |
| 12 namespace blink { | 15 namespace blink { |
| 13 | 16 |
| 14 // These values map to the features which can be controlled by Feature Policy. | 17 // 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 | 18 // TODO(iclelland): Link to the spec where the behaviour for each of these is |
| 16 // defined. | 19 // defined. |
| 17 enum class WebFeaturePolicyFeature { | 20 enum class WebFeaturePolicyFeature { |
| 18 NotFound = 0, | 21 NotFound = 0, |
| 19 // Controls access to document.cookie attribute. | 22 // Controls access to document.cookie attribute. |
| 20 DocumentCookie, | 23 DocumentCookie, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 WebVector<WebSecurityOrigin> origins; | 57 WebVector<WebSecurityOrigin> origins; |
| 55 }; | 58 }; |
| 56 | 59 |
| 57 // Used in Blink code to represent parsed headers. Used for IPC between renderer | 60 // Used in Blink code to represent parsed headers. Used for IPC between renderer |
| 58 // and browser. | 61 // and browser. |
| 59 using WebParsedFeaturePolicyHeader = | 62 using WebParsedFeaturePolicyHeader = |
| 60 WebVector<WebParsedFeaturePolicyDeclaration>; | 63 WebVector<WebParsedFeaturePolicyDeclaration>; |
| 61 | 64 |
| 62 } // namespace blink | 65 } // namespace blink |
| 63 | 66 |
| 67 #if INSIDE_BLINK |
| 68 namespace WTF { |
| 69 |
| 70 template <> |
| 71 struct DefaultHash<blink::WebFeaturePolicyFeature> { |
| 72 STATIC_ONLY(DefaultHash); |
| 73 using Hash = IntHash<blink::WebFeaturePolicyFeature>; |
| 74 }; |
| 75 |
| 76 template <> |
| 77 struct HashTraits<blink::WebFeaturePolicyFeature> |
| 78 : GenericHashTraits<blink::WebFeaturePolicyFeature> { |
| 79 STATIC_ONLY(HashTraits); |
| 80 static bool isDeletedValue(const blink::WebFeaturePolicyFeature& value) { |
| 81 return value == static_cast<blink::WebFeaturePolicyFeature>(-1); |
| 82 } |
| 83 static void constructDeletedValue(blink::WebFeaturePolicyFeature& slot, |
| 84 bool) { |
| 85 slot = static_cast<blink::WebFeaturePolicyFeature>(-1); |
| 86 } |
| 87 }; |
| 88 |
| 89 } // namespace WTF |
| 90 #endif |
| 91 |
| 64 #endif // WebFeaturePolicy_h | 92 #endif // WebFeaturePolicy_h |
| OLD | NEW |