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 |