OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_COMMON_CONTENT_SECURITY_POLICY_CSP_CONTEXT_H |
| 6 #define CONTENT_BROWSER_COMMON_CONTENT_SECURITY_POLICY_CSP_CONTEXT_H |
| 7 |
| 8 #include <memory> |
| 9 #include <vector> |
| 10 |
| 11 #include "content/common/content_export.h" |
| 12 #include "content/common/content_security_policy/csp_policy.h" |
| 13 #include "content/common/content_security_policy_header.h" |
| 14 #include "url/gurl.h" |
| 15 #include "url/origin.h" |
| 16 |
| 17 namespace content { |
| 18 |
| 19 class CONTENT_EXPORT CSPContext { |
| 20 public: |
| 21 CSPContext(); |
| 22 virtual ~CSPContext(); |
| 23 |
| 24 bool Allow(const std::vector<CSPPolicy>& policies, |
| 25 CSPDirective::Name directive_name, |
| 26 const GURL& url, |
| 27 bool is_redirect = false); |
| 28 |
| 29 void SetSelf(const url::Origin origin); |
| 30 bool AllowSelf(const GURL& url); |
| 31 bool ProtocolMatchesSelf(const GURL& url); |
| 32 |
| 33 virtual void LogToConsole(const std::string& message); |
| 34 virtual void ReportViolation( |
| 35 const std::string& directive_text, |
| 36 const std::string& effective_directive, |
| 37 const std::string& message, |
| 38 const GURL& blocked_url, |
| 39 const std::vector<std::string>& report_end_points, |
| 40 const std::string& header, |
| 41 blink::WebContentSecurityPolicyType disposition); |
| 42 |
| 43 private: |
| 44 virtual bool SchemeShouldByPass(const base::StringPiece& scheme); |
| 45 |
| 46 bool has_self_ = false; |
| 47 std::string self_scheme_; |
| 48 CSPSource self_source_; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(CSPContext); |
| 51 }; |
| 52 |
| 53 } // namespace content |
| 54 #endif // CONTENT_BROWSER_COMMON_CONTENT_SECURITY_POLICY_CSP_CONTEXT_H |
OLD | NEW |