OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ | 5 #ifndef CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ |
6 #define CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ | 6 #define CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "content/common/content_security_policy_header.h" | 12 #include "content/common/content_security_policy_header.h" |
13 #include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h" | 13 #include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h" |
14 #include "url/origin.h" | 14 #include "url/origin.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 enum class WebTreeScopeType; | 17 enum class WebTreeScopeType; |
18 enum class WebSandboxFlags; | 18 enum class WebSandboxFlags; |
19 } | 19 } |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 | 22 |
23 // This struct holds feature policy whitelist data that needs to be replicated | 23 // This struct holds feature policy whitelist data that needs to be replicated |
24 // between a RenderFrame and any of its associated RenderFrameProxies. A list of | 24 // between a RenderFrame and any of its associated RenderFrameProxies. A list of |
25 // these form part of the FrameReplicationState below (one entry per feature). | 25 // these form part of the FrameReplicationState below (one entry per feature). |
26 struct CONTENT_EXPORT FeaturePolicyParsedWhitelist { | 26 struct CONTENT_EXPORT ParsedFeaturePolicyDeclaration { |
27 FeaturePolicyParsedWhitelist(); | 27 ParsedFeaturePolicyDeclaration(); |
28 FeaturePolicyParsedWhitelist(const FeaturePolicyParsedWhitelist& fppw); | 28 ParsedFeaturePolicyDeclaration(const ParsedFeaturePolicyDeclaration& fppw); |
29 ~FeaturePolicyParsedWhitelist(); | 29 ~ParsedFeaturePolicyDeclaration(); |
30 | 30 |
31 std::string feature_name; | 31 std::string feature_name; |
32 bool matches_all_origins; | 32 bool matches_all_origins; |
33 std::vector<url::Origin> origins; | 33 std::vector<url::Origin> origins; |
34 }; | 34 }; |
35 | 35 |
36 using ParsedFeaturePolicy = std::vector<FeaturePolicyParsedWhitelist>; | 36 using ParsedFeaturePolicyHeader = std::vector<ParsedFeaturePolicyDeclaration>; |
37 | 37 |
38 // This structure holds information that needs to be replicated between a | 38 // This structure holds information that needs to be replicated between a |
39 // RenderFrame and any of its associated RenderFrameProxies. | 39 // RenderFrame and any of its associated RenderFrameProxies. |
40 struct CONTENT_EXPORT FrameReplicationState { | 40 struct CONTENT_EXPORT FrameReplicationState { |
41 FrameReplicationState(); | 41 FrameReplicationState(); |
42 FrameReplicationState(blink::WebTreeScopeType scope, | 42 FrameReplicationState(blink::WebTreeScopeType scope, |
43 const std::string& name, | 43 const std::string& name, |
44 const std::string& unique_name, | 44 const std::string& unique_name, |
45 blink::WebSandboxFlags sandbox_flags, | 45 blink::WebSandboxFlags sandbox_flags, |
46 blink::WebInsecureRequestPolicy insecure_request_policy, | 46 blink::WebInsecureRequestPolicy insecure_request_policy, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // in layout tests results). | 95 // in layout tests results). |
96 // | 96 // |
97 // |unique_name| needs to be replicated to ensure that unique name for a given | 97 // |unique_name| needs to be replicated to ensure that unique name for a given |
98 // frame is the same across all renderers - without replication a renderer | 98 // frame is the same across all renderers - without replication a renderer |
99 // might arrive at a different value when recalculating the unique name from | 99 // might arrive at a different value when recalculating the unique name from |
100 // scratch. | 100 // scratch. |
101 std::string unique_name; | 101 std::string unique_name; |
102 | 102 |
103 // Parsed feature policy header. May be empty if no header was sent with the | 103 // Parsed feature policy header. May be empty if no header was sent with the |
104 // document. | 104 // document. |
105 ParsedFeaturePolicy feature_policy_header; | 105 ParsedFeaturePolicyHeader feature_policy_header; |
106 | 106 |
107 // Accumulated CSP headers - gathered from http headers, <meta> elements, | 107 // Accumulated CSP headers - gathered from http headers, <meta> elements, |
108 // parent frames (in case of about:blank frames). | 108 // parent frames (in case of about:blank frames). |
109 std::vector<ContentSecurityPolicyHeader> accumulated_csp_headers; | 109 std::vector<ContentSecurityPolicyHeader> accumulated_csp_headers; |
110 | 110 |
111 // Whether the frame is in a document tree or a shadow tree, per the Shadow | 111 // Whether the frame is in a document tree or a shadow tree, per the Shadow |
112 // DOM spec: https://w3c.github.io/webcomponents/spec/shadow/ | 112 // DOM spec: https://w3c.github.io/webcomponents/spec/shadow/ |
113 // Note: This should really be const, as it can never change once a frame is | 113 // Note: This should really be const, as it can never change once a frame is |
114 // created. However, making it const makes it a pain to embed into IPC message | 114 // created. However, making it const makes it a pain to embed into IPC message |
115 // params: having a const member implicitly deletes the copy assignment | 115 // params: having a const member implicitly deletes the copy assignment |
116 // operator. | 116 // operator. |
117 blink::WebTreeScopeType scope; | 117 blink::WebTreeScopeType scope; |
118 | 118 |
119 // The insecure request policy that a frame's current document is enforcing. | 119 // The insecure request policy that a frame's current document is enforcing. |
120 // Updates are immediately sent to all frame proxies when frames live in | 120 // Updates are immediately sent to all frame proxies when frames live in |
121 // different processes. | 121 // different processes. |
122 blink::WebInsecureRequestPolicy insecure_request_policy; | 122 blink::WebInsecureRequestPolicy insecure_request_policy; |
123 | 123 |
124 // True if a frame's origin is unique and should be considered potentially | 124 // True if a frame's origin is unique and should be considered potentially |
125 // trustworthy. | 125 // trustworthy. |
126 bool has_potentially_trustworthy_unique_origin; | 126 bool has_potentially_trustworthy_unique_origin; |
127 | 127 |
128 // Whether the frame has ever received a user gesture anywhere. | 128 // Whether the frame has ever received a user gesture anywhere. |
129 bool has_received_user_gesture; | 129 bool has_received_user_gesture; |
130 }; | 130 }; |
131 | 131 |
132 } // namespace content | 132 } // namespace content |
133 | 133 |
134 #endif // CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ | 134 #endif // CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ |
OLD | NEW |