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

Unified Diff: content/renderer/render_frame_proxy.cc

Issue 2520223002: Replicate a parsed feature policy representation so it doesn't need to be parsed in the browser pro… (Closed)
Patch Set: Replicate a parsed feature policy representation so it doesn't need to be parsed in the browser pro… Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | third_party/WebKit/Source/core/dom/SecurityContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_proxy.cc
diff --git a/content/renderer/render_frame_proxy.cc b/content/renderer/render_frame_proxy.cc
index d8c1e9cd74eb5fc5978867b19b54a7f529f5f2c0..c4ee9ef55a1e6c89379ee2567feaf75b33a4f685 100644
--- a/content/renderer/render_frame_proxy.cc
+++ b/content/renderer/render_frame_proxy.cc
@@ -29,6 +29,7 @@
#include "content/renderer/render_widget.h"
#include "ipc/ipc_message_macros.h"
#include "third_party/WebKit/public/platform/URLConversion.h"
+#include "third_party/WebKit/public/platform/WebFeaturePolicy.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
@@ -47,6 +48,22 @@ static base::LazyInstance<RoutingIDProxyMap> g_routing_id_proxy_map =
typedef std::map<blink::WebFrame*, RenderFrameProxy*> FrameMap;
base::LazyInstance<FrameMap> g_frame_map = LAZY_INSTANCE_INITIALIZER;
+blink::WebParsedFeaturePolicy ToWebParsedFeaturePolicy(
+ const ParsedFeaturePolicy& parsed_whitelists) {
+ std::vector<blink::WebFeaturePolicy::ParsedWhitelist> result;
+ for (const FeaturePolicyParsedWhitelist& whitelist : parsed_whitelists) {
+ blink::WebFeaturePolicy::ParsedWhitelist web_whitelist;
+ web_whitelist.featureName =
+ blink::WebString::fromUTF8(whitelist.feature_name);
+ web_whitelist.matchesAllOrigins = whitelist.matches_all_origins;
+ std::vector<blink::WebSecurityOrigin> web_origins;
+ for (const url::Origin& origin : whitelist.origins)
+ web_origins.push_back(origin);
+ result.push_back(web_whitelist);
+ }
+ return result;
+}
+
} // namespace
// static
@@ -224,7 +241,7 @@ void RenderFrameProxy::SetReplicatedState(const FrameReplicationState& state) {
web_frame_->setReplicatedPotentiallyTrustworthyUniqueOrigin(
state.has_potentially_trustworthy_unique_origin);
web_frame_->setReplicatedFeaturePolicyHeader(
- blink::WebString::fromUTF8(state.feature_policy_header));
+ ToWebParsedFeaturePolicy(state.feature_policy_header));
web_frame_->resetReplicatedContentSecurityPolicy();
for (const auto& header : state.accumulated_csp_headers)
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | third_party/WebKit/Source/core/dom/SecurityContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698