Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: third_party/WebKit/public/platform/WebFeaturePolicy.h

Issue 2651883008: Make content::FeaturePolicy implement WebFeaturePolicy, and use it in blink code (Closed)
Patch Set: Duplicate FP object rather than modifying in-place Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "WebCommon.h"
8 #include "WebSecurityOrigin.h" 9 #include "WebSecurityOrigin.h"
9 #include "WebString.h" 10 #include "WebString.h"
10 #include "WebVector.h" 11 #include "WebVector.h"
11 12
12 namespace blink { 13 namespace blink {
13 14
14 // These values map to the features which can be controlled by Feature Policy. 15 // 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 // TODO(iclelland): Link to the spec where the behaviour for each of these is
16 // defined. 17 // defined.
17 enum class WebFeaturePolicyFeature { 18 enum class WebFeaturePolicyFeature {
(...skipping 22 matching lines...) Expand all
40 SyncXHR, 41 SyncXHR,
41 // Controls access to NavigatorUserMedia interface. 42 // Controls access to NavigatorUserMedia interface.
42 Usermedia, 43 Usermedia,
43 // Controls access to navigator.vibrate method. 44 // Controls access to navigator.vibrate method.
44 Vibrate, 45 Vibrate,
45 // Controls access to RTCPeerConnection interface. 46 // Controls access to RTCPeerConnection interface.
46 WebRTC, 47 WebRTC,
47 LAST_FEATURE = WebRTC 48 LAST_FEATURE = WebRTC
48 }; 49 };
49 50
50 struct WebParsedFeaturePolicyDeclaration { 51 struct BLINK_PLATFORM_EXPORT WebParsedFeaturePolicyDeclaration {
51 WebParsedFeaturePolicyDeclaration() : matchesAllOrigins(false) {} 52 WebParsedFeaturePolicyDeclaration() : matchesAllOrigins(false) {}
52 WebString featureName; 53 WebString featureName;
53 bool matchesAllOrigins; 54 bool matchesAllOrigins;
54 WebVector<WebSecurityOrigin> origins; 55 WebVector<WebSecurityOrigin> origins;
55 }; 56 };
56 57
57 // Used in Blink code to represent parsed headers. Used for IPC between renderer 58 // Used in Blink code to represent parsed headers. Used for IPC between renderer
58 // and browser. 59 // and browser.
59 using WebParsedFeaturePolicyHeader = 60 using WebParsedFeaturePolicyHeader =
60 WebVector<WebParsedFeaturePolicyDeclaration>; 61 WebVector<WebParsedFeaturePolicyDeclaration>;
61 62
63 // Composed full policy for a document. Stored in SecurityContext for each
64 // document. This is essentially an opaque handle to an object in the embedder.
65 class BLINK_PLATFORM_EXPORT WebFeaturePolicy {
66 public:
67 virtual ~WebFeaturePolicy() {}
68
69 // Returns whether or not the given feature is enabled for the origin of the
70 // document that owns the policy.
71 virtual bool IsFeatureEnabled(blink::WebFeaturePolicyFeature) const = 0;
72 };
73
62 } // namespace blink 74 } // namespace blink
63 75
64 #endif // WebFeaturePolicy_h 76 #endif // WebFeaturePolicy_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698