Chromium Code Reviews| Index: content/common/content_security_policy/csp_context.h |
| diff --git a/content/common/content_security_policy/csp_context.h b/content/common/content_security_policy/csp_context.h |
| index d070a9912e37777cd36a48909bb32c1e22f0de0a..9eb7f6b851bea83fff8f23fb40845f0334d4f3f9 100644 |
| --- a/content/common/content_security_policy/csp_context.h |
| +++ b/content/common/content_security_policy/csp_context.h |
| @@ -16,6 +16,8 @@ |
| namespace content { |
| +struct CSPViolationParams; |
| + |
| class CONTENT_EXPORT CSPContext { |
| public: |
| CSPContext(); |
| @@ -31,14 +33,7 @@ class CONTENT_EXPORT CSPContext { |
| bool ProtocolMatchesSelf(const GURL& url); |
| virtual void LogToConsole(const std::string& message); |
| - virtual void ReportViolation( |
| - const std::string& directive_text, |
| - const std::string& effective_directive, |
| - const std::string& message, |
| - const GURL& blocked_url, |
| - const std::vector<std::string>& report_end_points, |
| - const std::string& header, |
| - blink::WebContentSecurityPolicyType disposition); |
| + virtual void ReportViolation(const CSPViolationParams& violation_params); |
| bool IsSelfBypassed(); |
| @@ -52,5 +47,43 @@ class CONTENT_EXPORT CSPContext { |
| DISALLOW_COPY_AND_ASSIGN(CSPContext); |
| }; |
| +// Used in CSPContext::ReportViolation() |
|
alexmos
2017/02/10 22:59:53
General note for these CLs: for the new CSP things
arthursonzogni
2017/02/13 16:33:20
Acknowledged.
|
| +struct CONTENT_EXPORT CSPViolationParams { |
| + CSPViolationParams(); |
| + CSPViolationParams(const std::string& directive, |
| + const std::string& effective_directive, |
| + const std::string& console_message, |
| + const GURL& blocked_url, |
| + const std::vector<std::string>& report_endpoints, |
| + const std::string& header, |
| + const blink::WebContentSecurityPolicyType& disposition); |
| + CSPViolationParams(const CSPViolationParams& other); |
| + ~CSPViolationParams(); |
| + |
| + // The name of the directive that infringe the policy. |directive| might be a |
| + // directive that serves as a fallback to the |effective_directive|. |
| + std::string directive; |
| + |
| + // The name the effective directive that was checked against. |
| + std::string effective_directive; |
| + |
| + // The console message that was displayed to the user. |
| + std::string console_message; |
| + |
| + // The URL that was blocked by the policy. |
| + GURL blocked_url; |
| + |
| + // The set of URI where a JSON-formatted report of the violation should be |
| + // sent. |
| + std::vector<std::string> report_endpoints; |
| + |
| + // The raw content security policy header that was infringed. |
| + std::string header; |
| + |
| + // Each policy has an associated disposition, which is either "enforce" or |
| + // "report". |
| + blink::WebContentSecurityPolicyType disposition; |
| +}; |
| + |
| } // namespace content |
| #endif // CONTENT_COMMON_CONTENT_SECURITY_POLICY_CSP_CONTEXT_H_ |