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

Unified Diff: content/renderer/content_security_policy_util.cc

Issue 2655463006: PlzNavigate: Enforce 'frame-src' CSP on the browser. (Closed)
Patch Set: Add TODO in the FrameLoader. 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/content_security_policy_util.cc
diff --git a/content/renderer/content_security_policy_util.cc b/content/renderer/content_security_policy_util.cc
index c660a88e1ad45b2b44d2d0c736ce5eff99906332..04a7b50ee10356cdb169c6b006136c218dd966b7 100644
--- a/content/renderer/content_security_policy_util.cc
+++ b/content/renderer/content_security_policy_util.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "content/renderer/content_security_policy_util.h"
-#include "third_party/WebKit/public/platform/WebContentSecurityPolicyStruct.h"
namespace content {
@@ -52,4 +51,24 @@ CSPPolicy BuildCSPPolicy(const blink::WebContentSecurityPolicyPolicy& policy) {
report_endpoints); // report_endpoints
}
+blink::WebContentSecurityPolicyViolation BuildWebContentSecurityPolicyViolation(
+ const content::CSPViolationParams& violation_params) {
+ blink::WebContentSecurityPolicyViolation violation;
+ violation.directive = blink::WebString::fromASCII(violation_params.directive);
+ violation.effectiveDirective =
+ blink::WebString::fromASCII(violation_params.effective_directive);
+ violation.consoleMessage =
+ blink::WebString::fromASCII(violation_params.console_message);
+ violation.blockedUrl = violation_params.blocked_url;
+ violation.reportEndpoints = blink::WebVector<blink::WebString>(
+ violation_params.report_endpoints.size());
+ for (size_t i = 0; i < violation_params.report_endpoints.size(); ++i)
nasko 2017/02/15 21:28:45 This for loop needs {} as the body spans more than
arthursonzogni 2017/02/16 17:32:41 Done.
+ violation.reportEndpoints[i] =
+ blink::WebString::fromASCII(violation_params.report_endpoints[i]);
+ violation.header = blink::WebString::fromASCII(violation_params.header);
+ violation.disposition = violation_params.disposition;
+ violation.followedRedirect = violation_params.followed_redirect;
+ return violation;
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698