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..8b6cb7d80fc5a4b9d1d8c1053724405fbec0fec1 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 ToWebFeaturePolicyParsedWhitelist( |
+ const std::vector<FeaturePolicyParsedWhitelist>& 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)); |
+ ToWebFeaturePolicyParsedWhitelist(state.feature_policy_header)); |
web_frame_->resetReplicatedContentSecurityPolicy(); |
for (const auto& header : state.accumulated_csp_headers) |