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 |
| 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). |
| 26 struct CONTENT_EXPORT FeaturePolicyParsedWhitelist { |
| 27 FeaturePolicyParsedWhitelist(); |
| 28 FeaturePolicyParsedWhitelist(const FeaturePolicyParsedWhitelist& fppw); |
| 29 ~FeaturePolicyParsedWhitelist(); |
| 30 |
| 31 std::string feature_name; |
| 32 bool matches_all_origins; |
| 33 std::vector<url::Origin> origins; |
| 34 }; |
| 35 |
| 36 using ParsedFeaturePolicy = std::vector<FeaturePolicyParsedWhitelist>; |
| 37 |
23 // This structure holds information that needs to be replicated between a | 38 // This structure holds information that needs to be replicated between a |
24 // RenderFrame and any of its associated RenderFrameProxies. | 39 // RenderFrame and any of its associated RenderFrameProxies. |
25 struct CONTENT_EXPORT FrameReplicationState { | 40 struct CONTENT_EXPORT FrameReplicationState { |
26 FrameReplicationState(); | 41 FrameReplicationState(); |
27 FrameReplicationState(blink::WebTreeScopeType scope, | 42 FrameReplicationState(blink::WebTreeScopeType scope, |
28 const std::string& name, | 43 const std::string& name, |
29 const std::string& unique_name, | 44 const std::string& unique_name, |
30 blink::WebSandboxFlags sandbox_flags, | 45 blink::WebSandboxFlags sandbox_flags, |
31 blink::WebInsecureRequestPolicy insecure_request_policy, | 46 blink::WebInsecureRequestPolicy insecure_request_policy, |
32 bool has_potentially_trustworthy_unique_origin); | 47 bool has_potentially_trustworthy_unique_origin); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // across different, unrelated navigations (i.e. to refer to the frame | 92 // across different, unrelated navigations (i.e. to refer to the frame |
78 // when going back/forward in session history OR when refering to the frame | 93 // when going back/forward in session history OR when refering to the frame |
79 // in layout tests results). | 94 // in layout tests results). |
80 // | 95 // |
81 // |unique_name| needs to be replicated to ensure that unique name for a given | 96 // |unique_name| needs to be replicated to ensure that unique name for a given |
82 // frame is the same across all renderers - without replication a renderer | 97 // frame is the same across all renderers - without replication a renderer |
83 // might arrive at a different value when recalculating the unique name from | 98 // might arrive at a different value when recalculating the unique name from |
84 // scratch. | 99 // scratch. |
85 std::string unique_name; | 100 std::string unique_name; |
86 | 101 |
87 // Feature policy header. May be empty if no header was sent with the | 102 // Parsed feature policy header. May be empty if no header was sent with the |
88 // document. | 103 // document. |
89 std::string feature_policy_header; | 104 ParsedFeaturePolicy feature_policy_header; |
90 | 105 |
91 // Accumulated CSP headers - gathered from http headers, <meta> elements, | 106 // Accumulated CSP headers - gathered from http headers, <meta> elements, |
92 // parent frames (in case of about:blank frames). | 107 // parent frames (in case of about:blank frames). |
93 std::vector<ContentSecurityPolicyHeader> accumulated_csp_headers; | 108 std::vector<ContentSecurityPolicyHeader> accumulated_csp_headers; |
94 | 109 |
95 // Whether the frame is in a document tree or a shadow tree, per the Shadow | 110 // Whether the frame is in a document tree or a shadow tree, per the Shadow |
96 // DOM spec: https://w3c.github.io/webcomponents/spec/shadow/ | 111 // DOM spec: https://w3c.github.io/webcomponents/spec/shadow/ |
97 // Note: This should really be const, as it can never change once a frame is | 112 // Note: This should really be const, as it can never change once a frame is |
98 // created. However, making it const makes it a pain to embed into IPC message | 113 // created. However, making it const makes it a pain to embed into IPC message |
99 // params: having a const member implicitly deletes the copy assignment | 114 // params: having a const member implicitly deletes the copy assignment |
100 // operator. | 115 // operator. |
101 blink::WebTreeScopeType scope; | 116 blink::WebTreeScopeType scope; |
102 | 117 |
103 // The insecure request policy that a frame's current document is enforcing. | 118 // The insecure request policy that a frame's current document is enforcing. |
104 // Updates are immediately sent to all frame proxies when frames live in | 119 // Updates are immediately sent to all frame proxies when frames live in |
105 // different processes. | 120 // different processes. |
106 blink::WebInsecureRequestPolicy insecure_request_policy; | 121 blink::WebInsecureRequestPolicy insecure_request_policy; |
107 | 122 |
108 // True if a frame's origin is unique and should be considered potentially | 123 // True if a frame's origin is unique and should be considered potentially |
109 // trustworthy. | 124 // trustworthy. |
110 bool has_potentially_trustworthy_unique_origin; | 125 bool has_potentially_trustworthy_unique_origin; |
111 | 126 |
112 // TODO(alexmos): Eventually, this structure can also hold other state that | 127 // TODO(alexmos): Eventually, this structure can also hold other state that |
113 // needs to be replicated, such as frame sizing info. | 128 // needs to be replicated, such as frame sizing info. |
114 }; | 129 }; |
115 | 130 |
116 } // namespace content | 131 } // namespace content |
117 | 132 |
118 #endif // CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ | 133 #endif // CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ |
OLD | NEW |