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

Unified Diff: content/common/content_security_policy/csp_context.cc

Issue 2761153003: PlzNavigate & CSP. Use the SourceLocation in violation reports. (Closed)
Patch Set: Nit. Created 3 years, 9 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/common/content_security_policy/csp_context.cc
diff --git a/content/common/content_security_policy/csp_context.cc b/content/common/content_security_policy/csp_context.cc
index 3c3b0fe533f71b8f64712e4184fc5ef6ae82da97..59a97efc2121defb2457e0b712c864e122864d09 100644
--- a/content/common/content_security_policy/csp_context.cc
+++ b/content/common/content_security_policy/csp_context.cc
@@ -10,15 +10,16 @@ CSPContext::CSPContext() : has_self_(false) {}
CSPContext::~CSPContext() {}
-bool CSPContext::IsAllowedByCsp(CSPDirective::Name directive_name,
- const GURL& url,
- bool is_redirect) {
+bool CSPContext::EnforceCsp(CSPDirective::Name directive_name,
+ const GURL& url,
+ bool is_redirect,
+ const SourceLocation& source_location) {
if (SchemeShouldBypassCSP(url.scheme_piece()))
return true;
for (const auto& policy : policies_) {
- if (!ContentSecurityPolicy::Allow(policy, directive_name, url, this,
- is_redirect))
+ if (!ContentSecurityPolicy::Allow(policy, directive_name, url, is_redirect,
+ this, source_location))
return false;
}
return true;
@@ -59,10 +60,6 @@ bool CSPContext::ProtocolMatchesSelf(const GURL& url) {
return url.SchemeIs(self_scheme_);
}
-void CSPContext::LogToConsole(const std::string& message) {
- return;
-}
-
bool CSPContext::SchemeShouldBypassCSP(const base::StringPiece& scheme) {
return false;
}
@@ -88,7 +85,8 @@ CSPViolationParams::CSPViolationParams(
const std::vector<std::string>& report_endpoints,
const std::string& header,
const blink::WebContentSecurityPolicyType& disposition,
- bool after_redirect)
+ bool after_redirect,
+ const SourceLocation& source_location)
: directive(directive),
effective_directive(effective_directive),
console_message(console_message),
@@ -96,7 +94,8 @@ CSPViolationParams::CSPViolationParams(
report_endpoints(report_endpoints),
header(header),
disposition(disposition),
- after_redirect(after_redirect) {}
+ after_redirect(after_redirect),
+ source_location(source_location) {}
CSPViolationParams::CSPViolationParams(const CSPViolationParams& other) =
default;

Powered by Google App Engine
This is Rietveld 408576698