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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 2612793002: Implement ContentSecurityPolicy on the browser-side. (Closed)
Patch Set: Rename SchemeShouldBypass => SchemeShouldBypassCSP. Created 3 years, 10 months 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
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 5ada65582183241bfa31bb1ed591dbc4bbbf0806..484c121cc1a39f246ff70bedbc639b2d98c5837a 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -53,6 +53,7 @@
#include "content/common/associated_interfaces.mojom.h"
#include "content/common/clipboard_messages.h"
#include "content/common/content_constants_internal.h"
+#include "content/common/content_security_policy/csp_context.h"
#include "content/common/content_security_policy_header.h"
#include "content/common/download/mhtml_save_status.h"
#include "content/common/edit_command.h"
@@ -95,6 +96,7 @@
#include "content/renderer/browser_plugin/browser_plugin.h"
#include "content/renderer/browser_plugin/browser_plugin_manager.h"
#include "content/renderer/child_frame_compositing_helper.h"
+#include "content/renderer/content_security_policy_util.h"
#include "content/renderer/context_menu_params_builder.h"
#include "content/renderer/devtools/devtools_agent.h"
#include "content/renderer/dom_automation_controller.h"
@@ -3202,15 +3204,19 @@ void RenderFrameImpl::didSetFeaturePolicyHeader(
void RenderFrameImpl::didAddContentSecurityPolicy(
const blink::WebString& header_value,
blink::WebContentSecurityPolicyType type,
- blink::WebContentSecurityPolicySource source) {
- if (!SiteIsolationPolicy::AreCrossProcessFramesPossible())
- return;
-
+ blink::WebContentSecurityPolicySource source,
+ const std::vector<blink::WebContentSecurityPolicyPolicy>& policies) {
ContentSecurityPolicyHeader header;
header.header_value = header_value.utf8();
header.type = type;
header.source = source;
- Send(new FrameHostMsg_DidAddContentSecurityPolicy(routing_id_, header));
+
+ std::vector<CSPPolicy> content_policies;
Mike West 2017/02/13 14:10:51 CSPPolicy => "Content Security Policy Policy". :(
arthursonzogni 2017/02/14 17:07:03 I like thinking that Content-Security-Policy is {t
+ for (const auto& policy : policies)
+ content_policies.push_back(BuildCSPPolicy(policy));
+
+ Send(new FrameHostMsg_DidAddContentSecurityPolicy(routing_id_, header,
+ content_policies));
}
void RenderFrameImpl::didChangeFrameOwnerProperties(

Powered by Google App Engine
This is Rietveld 408576698