#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_CSP_CSP_DIRECTIVE_LIST_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_CSP_CSP_DIRECTIVE_LIST_H_
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/frame/csp/content_security_policy.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_request.h"
#include "third_party/blink/renderer/platform/weborigin/reporting_disposition.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink {
class KURL;
enum class ResourceType : uint8_t;
struct CORE_EXPORT CSPOperativeDirective { … };
CORE_EXPORT
bool CSPDirectiveListIsReportOnly(
const network::mojom::blink::ContentSecurityPolicy& csp);
CORE_EXPORT
CSPCheckResult CSPDirectiveListAllowFromSource(
const network::mojom::blink::ContentSecurityPolicy& csp,
ContentSecurityPolicy* policy,
CSPDirectiveName type,
const KURL& url,
const KURL& url_before_redirects,
ResourceRequest::RedirectStatus redirect_status,
ReportingDisposition reporting_disposition,
const String& nonce = String(),
const IntegrityMetadataSet& hashes = IntegrityMetadataSet(),
ParserDisposition parser_disposition = kParserInserted);
CORE_EXPORT
bool CSPDirectiveListAllowTrustedTypeAssignmentFailure(
const network::mojom::blink::ContentSecurityPolicy& csp,
ContentSecurityPolicy* policy,
const String& message,
const String& sample,
const String& sample_prefix,
std::optional<base::UnguessableToken> issue_id);
CORE_EXPORT
bool CSPDirectiveListAllowTrustedTypePolicy(
const network::mojom::blink::ContentSecurityPolicy& csp,
ContentSecurityPolicy* policy,
const String& policy_name,
bool is_duplicate,
ContentSecurityPolicy::AllowTrustedTypePolicyDetails& violation_details,
std::optional<base::UnguessableToken> issue_id);
CORE_EXPORT
bool CSPDirectiveListRequiresTrustedTypes(
const network::mojom::blink::ContentSecurityPolicy& csp);
CORE_EXPORT
bool CSPDirectiveListAllowInline(
const network::mojom::blink::ContentSecurityPolicy& csp,
ContentSecurityPolicy* policy,
ContentSecurityPolicy::InlineType inline_type,
Element* element,
const String& content,
const String& nonce,
const String& context_url,
const WTF::OrdinalNumber& context_line,
ReportingDisposition reporting_disposition);
CORE_EXPORT
bool CSPDirectiveListShouldCheckEval(
const network::mojom::blink::ContentSecurityPolicy& csp);
CORE_EXPORT
bool CSPDirectiveListAllowEval(
const network::mojom::blink::ContentSecurityPolicy& csp,
ContentSecurityPolicy* policy,
ReportingDisposition reporting_disposition,
ContentSecurityPolicy::ExceptionStatus exception_status,
const String& content);
CORE_EXPORT
bool CSPDirectiveListAllowWasmCodeGeneration(
const network::mojom::blink::ContentSecurityPolicy& csp,
ContentSecurityPolicy* policy,
ReportingDisposition reporting_disposition,
ContentSecurityPolicy::ExceptionStatus exception_status,
const String& content);
CORE_EXPORT
bool CSPDirectiveListShouldDisableEval(
const network::mojom::blink::ContentSecurityPolicy& csp,
String& error_message);
CORE_EXPORT
bool CSPDirectiveListShouldDisableWasmEval(
const network::mojom::blink::ContentSecurityPolicy& csp,
const ContentSecurityPolicy* policy,
String& error_message);
CORE_EXPORT
bool CSPDirectiveListAllowDynamic(
const network::mojom::blink::ContentSecurityPolicy& csp,
CSPDirectiveName directive_type);
CORE_EXPORT
bool CSPDirectiveListAllowHash(
const network::mojom::blink::ContentSecurityPolicy& csp,
const network::mojom::blink::CSPHashSource& hash_value,
const ContentSecurityPolicy::InlineType inline_type);
CORE_EXPORT
bool CSPDirectiveListIsObjectRestrictionReasonable(
const network::mojom::blink::ContentSecurityPolicy& csp);
CORE_EXPORT
bool CSPDirectiveListIsBaseRestrictionReasonable(
const network::mojom::blink::ContentSecurityPolicy& csp);
CORE_EXPORT
bool CSPDirectiveListIsScriptRestrictionReasonable(
const network::mojom::blink::ContentSecurityPolicy& csp);
CORE_EXPORT
bool CSPDirectiveListIsActiveForConnections(
const network::mojom::blink::ContentSecurityPolicy& csp);
CORE_EXPORT
CSPOperativeDirective CSPDirectiveListOperativeDirective(
const network::mojom::blink::ContentSecurityPolicy& csp,
CSPDirectiveName type);
}
#endif