#include "net/reporting/reporting_header_parser.h"
#include <cstring>
#include <string>
#include <utility>
#include <vector>
#include "base/check.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/metrics/histogram_functions.h"
#include "base/time/time.h"
#include "base/values.h"
#include "net/base/features.h"
#include "net/base/isolation_info.h"
#include "net/base/network_anonymization_key.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "net/reporting/reporting_cache.h"
#include "net/reporting/reporting_context.h"
#include "net/reporting/reporting_delegate.h"
#include "net/reporting/reporting_endpoint.h"
#include "net/reporting/reporting_target_type.h"
namespace net {
namespace {
const char kUrlKey[] = …;
const char kIncludeSubdomainsKey[] = …;
const char kEndpointsKey[] = …;
const char kGroupKey[] = …;
const char kDefaultGroupName[] = …;
const char kMaxAgeKey[] = …;
const char kPriorityKey[] = …;
const char kWeightKey[] = …;
bool ProcessEndpointURLString(const std::string& endpoint_url_string,
const url::Origin& header_origin,
GURL& endpoint_url_out) { … }
bool ProcessEndpoint(ReportingDelegate* delegate,
const ReportingEndpointGroupKey& group_key,
const base::Value& value,
ReportingEndpoint::EndpointInfo* endpoint_info_out) { … }
bool ProcessEndpointGroup(
ReportingDelegate* delegate,
ReportingCache* cache,
const NetworkAnonymizationKey& network_anonymization_key,
const url::Origin& origin,
const base::Value& value,
ReportingEndpointGroup* parsed_endpoint_group_out) { … }
bool ProcessEndpoint(ReportingDelegate* delegate,
const ReportingEndpointGroupKey& group_key,
const std::string& endpoint_url_string,
ReportingEndpoint::EndpointInfo& endpoint_info_out) { … }
bool ProcessV1Endpoint(ReportingDelegate* delegate,
ReportingCache* cache,
const base::UnguessableToken& reporting_source,
const NetworkAnonymizationKey& network_anonymization_key,
const url::Origin& origin,
const std::string& endpoint_name,
const std::string& endpoint_url_string,
ReportingEndpoint& parsed_endpoint_out) { … }
}
std::optional<base::flat_map<std::string, std::string>> ParseReportingEndpoints(
const std::string& header) { … }
void ReportingHeaderParser::RecordReportingHeaderType(
ReportingHeaderType header_type) { … }
void ReportingHeaderParser::ParseReportToHeader(
ReportingContext* context,
const NetworkAnonymizationKey& network_anonymization_key,
const url::Origin& origin,
const base::Value::List& list) { … }
void ReportingHeaderParser::ProcessParsedReportingEndpointsHeader(
ReportingContext* context,
const base::UnguessableToken& reporting_source,
const IsolationInfo& isolation_info,
const NetworkAnonymizationKey& network_anonymization_key,
const url::Origin& origin,
base::flat_map<std::string, std::string> header) { … }
}