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 "public/platform/WebFeaturePolicy.h" | 10 #include "public/platform/WebFeaturePolicy.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 // Returns whether or not the given feature is enabled for the frame that owns | 151 // Returns whether or not the given feature is enabled for the frame that owns |
152 // the policy. | 152 // the policy. |
153 bool isFeatureEnabled(const Feature&) const; | 153 bool isFeatureEnabled(const Feature&) const; |
154 | 154 |
155 // Returns the list of features which can be controlled by Feature Policy. | 155 // Returns the list of features which can be controlled by Feature Policy. |
156 static FeatureList& getDefaultFeatureList(); | 156 static FeatureList& getDefaultFeatureList(); |
157 | 157 |
158 String toString(); | 158 String toString(); |
159 | 159 |
| 160 // Returns the corresponding WebFeaturePolicyFeature enum given a feature |
| 161 // string. |
| 162 static WebFeaturePolicyFeature getWebFeaturePolicyFeature( |
| 163 const String& feature); |
| 164 |
160 private: | 165 private: |
161 friend class FeaturePolicyTest; | 166 friend class FeaturePolicyTest; |
162 friend class FeaturePolicyInFrameTest; | 167 friend class FeaturePolicyInFrameTest; |
163 | 168 |
164 FeaturePolicy(RefPtr<SecurityOrigin>, FeatureList& features); | 169 FeaturePolicy(RefPtr<SecurityOrigin>, FeatureList& features); |
165 | 170 |
166 static std::unique_ptr<FeaturePolicy> createFromParentPolicy( | 171 static std::unique_ptr<FeaturePolicy> createFromParentPolicy( |
167 const FeaturePolicy* parent, | 172 const FeaturePolicy* parent, |
168 RefPtr<SecurityOrigin>, | 173 RefPtr<SecurityOrigin>, |
169 FeatureList& features); | 174 FeatureList& features); |
(...skipping 29 matching lines...) Expand all Loading... |
199 extern const PLATFORM_EXPORT FeaturePolicy::Feature kPushFeature; | 204 extern const PLATFORM_EXPORT FeaturePolicy::Feature kPushFeature; |
200 extern const PLATFORM_EXPORT FeaturePolicy::Feature kSyncScript; | 205 extern const PLATFORM_EXPORT FeaturePolicy::Feature kSyncScript; |
201 extern const PLATFORM_EXPORT FeaturePolicy::Feature kSyncXHR; | 206 extern const PLATFORM_EXPORT FeaturePolicy::Feature kSyncXHR; |
202 extern const PLATFORM_EXPORT FeaturePolicy::Feature kUsermedia; | 207 extern const PLATFORM_EXPORT FeaturePolicy::Feature kUsermedia; |
203 extern const PLATFORM_EXPORT FeaturePolicy::Feature kVibrateFeature; | 208 extern const PLATFORM_EXPORT FeaturePolicy::Feature kVibrateFeature; |
204 extern const PLATFORM_EXPORT FeaturePolicy::Feature kWebRTC; | 209 extern const PLATFORM_EXPORT FeaturePolicy::Feature kWebRTC; |
205 | 210 |
206 } // namespace blink | 211 } // namespace blink |
207 | 212 |
208 #endif // FeaturePolicy_h | 213 #endif // FeaturePolicy_h |
OLD | NEW |