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 FeaturePolicy_h | 5 #ifndef FeaturePolicy_h |
6 #define FeaturePolicy_h | 6 #define FeaturePolicy_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "platform/weborigin/SecurityOrigin.h" | 9 #include "platform/weborigin/SecurityOrigin.h" |
10 #include "wtf/RefPtr.h" | 10 #include "wtf/RefPtr.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 FeatureDefault defaultPolicy; | 121 FeatureDefault defaultPolicy; |
122 }; | 122 }; |
123 | 123 |
124 using FeatureList = const Vector<const FeaturePolicy::Feature*>; | 124 using FeatureList = const Vector<const FeaturePolicy::Feature*>; |
125 | 125 |
126 static std::unique_ptr<FeaturePolicy> createFromParentPolicy( | 126 static std::unique_ptr<FeaturePolicy> createFromParentPolicy( |
127 const FeaturePolicy* parent, | 127 const FeaturePolicy* parent, |
128 RefPtr<SecurityOrigin>); | 128 RefPtr<SecurityOrigin>); |
129 | 129 |
130 // Sets the declared policy from the Feature-Policy HTTP header. If the header | 130 // Sets the declared policy from the Feature-Policy HTTP header. If the header |
131 // cannot be parsed, errors will be appended to the |messages| vector. | 131 // cannot be parsed, errors will be appended to the |messages| vector, if not |
132 void setHeaderPolicy(const String&, Vector<String>& messages); | 132 // null. |
| 133 void setHeaderPolicy(const String&, Vector<String>* messages); |
133 | 134 |
134 // Returns whether or not the given feature is enabled by this policy. | 135 // Returns whether or not the given feature is enabled by this policy. |
135 bool isFeatureEnabledForOrigin(const Feature&, const SecurityOrigin&) const; | 136 bool isFeatureEnabledForOrigin(const Feature&, const SecurityOrigin&) const; |
136 | 137 |
137 // Returns whether or not the given feature is enabled for the frame that owns | 138 // Returns whether or not the given feature is enabled for the frame that owns |
138 // the policy. | 139 // the policy. |
139 bool isFeatureEnabled(const Feature&) const; | 140 bool isFeatureEnabled(const Feature&) const; |
140 | 141 |
141 // Returns the list of features which can be controlled by Feature Policy. | 142 // Returns the list of features which can be controlled by Feature Policy. |
142 static FeatureList& getDefaultFeatureList(); | 143 static FeatureList& getDefaultFeatureList(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 extern const PLATFORM_EXPORT FeaturePolicy::Feature kPushFeature; | 184 extern const PLATFORM_EXPORT FeaturePolicy::Feature kPushFeature; |
184 extern const PLATFORM_EXPORT FeaturePolicy::Feature kSyncScript; | 185 extern const PLATFORM_EXPORT FeaturePolicy::Feature kSyncScript; |
185 extern const PLATFORM_EXPORT FeaturePolicy::Feature kSyncXHR; | 186 extern const PLATFORM_EXPORT FeaturePolicy::Feature kSyncXHR; |
186 extern const PLATFORM_EXPORT FeaturePolicy::Feature kUsermedia; | 187 extern const PLATFORM_EXPORT FeaturePolicy::Feature kUsermedia; |
187 extern const PLATFORM_EXPORT FeaturePolicy::Feature kVibrateFeature; | 188 extern const PLATFORM_EXPORT FeaturePolicy::Feature kVibrateFeature; |
188 extern const PLATFORM_EXPORT FeaturePolicy::Feature kWebRTC; | 189 extern const PLATFORM_EXPORT FeaturePolicy::Feature kWebRTC; |
189 | 190 |
190 } // namespace blink | 191 } // namespace blink |
191 | 192 |
192 #endif // FeaturePolicy_h | 193 #endif // FeaturePolicy_h |
OLD | NEW |