| Index: content/common/content_security_policy/csp_policy.h | 
| diff --git a/content/common/content_security_policy/csp_policy.h b/content/common/content_security_policy/csp_policy.h | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..c8a09544f96621b36f315dc58a1a67ece6024c30 | 
| --- /dev/null | 
| +++ b/content/common/content_security_policy/csp_policy.h | 
| @@ -0,0 +1,58 @@ | 
| +// Copyright 2017 The Chromium Authors. All rights reserved. | 
| +// Use of this source code is governed by a BSD-style license that can be | 
| +// found in the LICENSE file. | 
| + | 
| +#ifndef CONTENT_BROWSER_COMMON_CONTENT_SECURITY_POLICY_POLICY_H | 
| +#define CONTENT_BROWSER_COMMON_CONTENT_SECURITY_POLICY_POLICY_H | 
| + | 
| +#include <memory> | 
| +#include <vector> | 
| + | 
| +#include "content/common/content_export.h" | 
| +#include "content/common/content_security_policy/csp_directive.h" | 
| +#include "content/common/content_security_policy_header.h" | 
| +#include "url/gurl.h" | 
| + | 
| +namespace content { | 
| + | 
| +class CSPContext; | 
| + | 
| +// https://www.w3.org/TR/CSP3/#framework-policy | 
| +struct CONTENT_EXPORT CSPPolicy { | 
| +  CSPPolicy(); | 
| +  CSPPolicy(blink::WebContentSecurityPolicyType disposition, | 
| +            blink::WebContentSecurityPolicySource source, | 
| +            const std::vector<CSPDirective>& directives, | 
| +            const std::vector<std::string>& report_end_points); | 
| +  CSPPolicy(const CSPPolicy&); | 
| +  ~CSPPolicy(); | 
| + | 
| +  blink::WebContentSecurityPolicyType disposition; | 
| +  blink::WebContentSecurityPolicySource source; | 
| +  std::vector<CSPDirective> directives; | 
| +  std::vector<std::string> report_end_points; | 
| + | 
| +  static CSPPolicy Parse(CSPContext* context, | 
| +                         const ContentSecurityPolicyHeader& header); | 
| + | 
| +  bool Allow(CSPContext* context, | 
| +             CSPDirective::Name directive, | 
| +             const GURL& url, | 
| +             bool is_redirect = false) const; | 
| + | 
| +  std::string ToString() const; | 
| + | 
| + private: | 
| +  bool AllowDirective(CSPContext* context, | 
| +                      CSPDirective::Name directive_name, | 
| +                      const CSPDirective& directive, | 
| +                      const GURL& url, | 
| +                      bool is_redirect) const; | 
| +  void ReportViolation(CSPContext* context, | 
| +                       const CSPDirective::Name effective_directive, | 
| +                       const CSPDirective& directive, | 
| +                       const GURL& url) const; | 
| +}; | 
| + | 
| +}  // namespace content | 
| +#endif  // CONTENT_BROWSER_COMMON_CONTENT_SECURITY_POLICY_POLICY_H | 
|  |