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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 2190183002: Forward CSP violation reporting from RenderFrameProxy to RenderFrameImpl. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove no longer applicable TODO and early exit from reportViolation method. Created 4 years, 4 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 4e91ee36f7350f1734aeaa43abb4a52c4684a5a3..8795b594346aec3ab222e9c103acefad588a0ec9 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -50,7 +50,7 @@
#include "content/common/accessibility_messages.h"
#include "content/common/clipboard_messages.h"
#include "content/common/content_constants_internal.h"
-#include "content/common/content_security_policy_header.h"
+#include "content/common/content_security_policy_structs.h"
#include "content/common/frame_messages.h"
#include "content/common/frame_owner_properties.h"
#include "content/common/frame_replication_state.h"
@@ -1571,6 +1571,8 @@ bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs,
OnSuppressFurtherDialogs)
IPC_MESSAGE_HANDLER(FrameMsg_RunFileChooserResponse, OnFileChooserResponse)
+ IPC_MESSAGE_HANDLER(FrameMsg_ReportContentSecurityPolicyViolation,
+ OnReportContentSecurityPolicyViolation)
#if defined(OS_ANDROID)
IPC_MESSAGE_HANDLER(FrameMsg_ActivateNearestFindResult,
OnActivateNearestFindResult)
@@ -5321,6 +5323,23 @@ void RenderFrameImpl::OnFileChooserResponse(
}
}
+void RenderFrameImpl::OnReportContentSecurityPolicyViolation(
+ const ContentSecurityPolicyViolation& violation) {
+ blink::WebVector<blink::WebString> web_report_endpoints(
+ violation.report_endpoints.size());
+ for (size_t i = 0; i < web_report_endpoints.size(); i++) {
+ web_report_endpoints[i] =
+ WebString::fromUTF8(violation.report_endpoints[i]);
+ }
+
+ GetWebFrame()->reportContentSecurityPolicyViolation(
alexmos 2016/08/09 18:01:19 nit: this is fine, but most other code seems to ju
Łukasz Anforowicz 2016/08/09 22:23:20 Done.
+ WebString::fromUTF8(violation.directive_text),
+ WebString::fromUTF8(violation.effective_directive),
+ WebString::fromUTF8(violation.console_message), violation.blocked_url,
+ web_report_endpoints, WebString::fromUTF8(violation.header),
+ violation.violation_type, violation.followed_redirect);
+}
+
#if defined(OS_ANDROID)
void RenderFrameImpl::OnActivateNearestFindResult(int request_id,
float x,

Powered by Google App Engine
This is Rietveld 408576698