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

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

Issue 2655463006: PlzNavigate: Enforce 'frame-src' CSP on the browser. (Closed)
Patch Set: Rebase. 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 b7edf25b470d1a9e656b37b4c255d3a56e086fcf..3c3b0fe533f71b8f64712e4184fc5ef6ae82da97 100644
--- a/content/common/content_security_policy/csp_context.cc
+++ b/content/common/content_security_policy/csp_context.cc
@@ -10,14 +10,13 @@ CSPContext::CSPContext() : has_self_(false) {}
CSPContext::~CSPContext() {}
-bool CSPContext::Allow(const std::vector<ContentSecurityPolicy>& policies,
- CSPDirective::Name directive_name,
- const GURL& url,
- bool is_redirect) {
+bool CSPContext::IsAllowedByCsp(CSPDirective::Name directive_name,
+ const GURL& url,
+ bool is_redirect) {
if (SchemeShouldBypassCSP(url.scheme_piece()))
return true;
- for (const auto& policy : policies) {
+ for (const auto& policy : policies_) {
if (!ContentSecurityPolicy::Allow(policy, directive_name, url, this,
is_redirect))
return false;
@@ -68,21 +67,40 @@ bool CSPContext::SchemeShouldBypassCSP(const base::StringPiece& scheme) {
return false;
}
-bool CSPContext::SelfSchemeShouldBypassCSP() {
+bool CSPContext::SelfSchemeShouldBypassCsp() {
if (!has_self_)
return false;
return SchemeShouldBypassCSP(self_scheme_);
}
-void CSPContext::ReportViolation(
- const std::string& directive_text,
+void CSPContext::ReportContentSecurityPolicyViolation(
+ const CSPViolationParams& violation_params) {
+ return;
+}
+
+CSPViolationParams::CSPViolationParams() = default;
+
+CSPViolationParams::CSPViolationParams(
+ const std::string& directive,
const std::string& effective_directive,
- const std::string& message,
+ const std::string& console_message,
const GURL& blocked_url,
- const std::vector<std::string>& report_end_points,
+ const std::vector<std::string>& report_endpoints,
const std::string& header,
- blink::WebContentSecurityPolicyType disposition) {
- return;
-}
+ const blink::WebContentSecurityPolicyType& disposition,
+ bool after_redirect)
+ : directive(directive),
+ effective_directive(effective_directive),
+ console_message(console_message),
+ blocked_url(blocked_url),
+ report_endpoints(report_endpoints),
+ header(header),
+ disposition(disposition),
+ after_redirect(after_redirect) {}
+
+CSPViolationParams::CSPViolationParams(const CSPViolationParams& other) =
+ default;
+
+CSPViolationParams::~CSPViolationParams() {}
} // namespace content
« no previous file with comments | « content/common/content_security_policy/csp_context.h ('k') | content/common/content_security_policy/csp_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698