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

Side by Side Diff: content/common/frame_replication_state.h

Issue 2520223002: Replicate a parsed feature policy representation so it doesn't need to be parsed in the browser pro… (Closed)
Patch Set: Created 4 years, 1 month 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 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/WebFeaturePolicy.h"
13 #include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h" 14 #include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h"
14 #include "url/origin.h" 15 #include "url/origin.h"
15 16
16 namespace blink { 17 namespace blink {
17 enum class WebTreeScopeType; 18 enum class WebTreeScopeType;
18 enum class WebSandboxFlags; 19 enum class WebSandboxFlags;
19 } 20 }
20 21
21 namespace content { 22 namespace content {
22 23
24 struct FeaturePolicyParsedWhitelist {
25 static std::vector<FeaturePolicyParsedWhitelist>
26 fromWebFeaturePolicyParsedWhitelist(
27 const blink::WebVector<blink::WebFeaturePolicy::ParsedWhitelist>&
28 web_parsed_whitelists);
29 static blink::WebVector<blink::WebFeaturePolicy::ParsedWhitelist>
30 toWebFeaturePolicyParsedWhitelist(
31 const std::vector<FeaturePolicyParsedWhitelist>& parsed_whitelists);
32
33 FeaturePolicyParsedWhitelist();
34 FeaturePolicyParsedWhitelist(const FeaturePolicyParsedWhitelist& fpw);
35 ~FeaturePolicyParsedWhitelist();
36
37 std::string feature_name;
38 bool matches_all_origins;
39 std::vector<std::string> origins;
40 };
41
23 // This structure holds information that needs to be replicated between a 42 // This structure holds information that needs to be replicated between a
24 // RenderFrame and any of its associated RenderFrameProxies. 43 // RenderFrame and any of its associated RenderFrameProxies.
25 struct CONTENT_EXPORT FrameReplicationState { 44 struct CONTENT_EXPORT FrameReplicationState {
26 FrameReplicationState(); 45 FrameReplicationState();
27 FrameReplicationState(blink::WebTreeScopeType scope, 46 FrameReplicationState(blink::WebTreeScopeType scope,
28 const std::string& name, 47 const std::string& name,
29 const std::string& unique_name, 48 const std::string& unique_name,
30 blink::WebSandboxFlags sandbox_flags, 49 blink::WebSandboxFlags sandbox_flags,
31 blink::WebInsecureRequestPolicy insecure_request_policy, 50 blink::WebInsecureRequestPolicy insecure_request_policy,
32 bool has_potentially_trustworthy_unique_origin); 51 bool has_potentially_trustworthy_unique_origin);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // across different, unrelated navigations (i.e. to refer to the frame 96 // 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 97 // when going back/forward in session history OR when refering to the frame
79 // in layout tests results). 98 // in layout tests results).
80 // 99 //
81 // |unique_name| needs to be replicated to ensure that unique name for a given 100 // |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 101 // frame is the same across all renderers - without replication a renderer
83 // might arrive at a different value when recalculating the unique name from 102 // might arrive at a different value when recalculating the unique name from
84 // scratch. 103 // scratch.
85 std::string unique_name; 104 std::string unique_name;
86 105
87 // Feature policy header. May be empty if no header was sent with the 106 // Parsed feature policy header. May be empty if no header was sent with the
88 // document. 107 // document.
89 std::string feature_policy_header; 108 std::vector<FeaturePolicyParsedWhitelist> feature_policy_header;
90 109
91 // Accumulated CSP headers - gathered from http headers, <meta> elements, 110 // Accumulated CSP headers - gathered from http headers, <meta> elements,
92 // parent frames (in case of about:blank frames). 111 // parent frames (in case of about:blank frames).
93 std::vector<ContentSecurityPolicyHeader> accumulated_csp_headers; 112 std::vector<ContentSecurityPolicyHeader> accumulated_csp_headers;
94 113
95 // Whether the frame is in a document tree or a shadow tree, per the Shadow 114 // 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/ 115 // 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 116 // 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 117 // 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 118 // params: having a const member implicitly deletes the copy assignment
100 // operator. 119 // operator.
101 blink::WebTreeScopeType scope; 120 blink::WebTreeScopeType scope;
102 121
103 // The insecure request policy that a frame's current document is enforcing. 122 // 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 123 // Updates are immediately sent to all frame proxies when frames live in
105 // different processes. 124 // different processes.
106 blink::WebInsecureRequestPolicy insecure_request_policy; 125 blink::WebInsecureRequestPolicy insecure_request_policy;
107 126
108 // True if a frame's origin is unique and should be considered potentially 127 // True if a frame's origin is unique and should be considered potentially
109 // trustworthy. 128 // trustworthy.
110 bool has_potentially_trustworthy_unique_origin; 129 bool has_potentially_trustworthy_unique_origin;
111 130
112 // TODO(alexmos): Eventually, this structure can also hold other state that 131 // TODO(alexmos): Eventually, this structure can also hold other state that
113 // needs to be replicated, such as frame sizing info. 132 // needs to be replicated, such as frame sizing info.
114 }; 133 };
115 134
116 } // namespace content 135 } // namespace content
117 136
118 #endif // CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ 137 #endif // CONTENT_COMMON_FRAME_REPLICATION_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698