chromium/net/reporting/reporting_header_parser.h

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef NET_REPORTING_REPORTING_HEADER_PARSER_H_
#define NET_REPORTING_REPORTING_HEADER_PARSER_H_

#include <memory>
#include <optional>

#include "base/containers/flat_map.h"
#include "base/values.h"
#include "net/base/net_export.h"
#include "net/http/structured_headers.h"
#include "url/gurl.h"
#include "url/origin.h"

namespace net {

class IsolationInfo;
class NetworkAnonymizationKey;
class ReportingContext;

// Tries to parse a Reporting-Endpoints header. Returns base::nullopt if parsing
// failed and the header should be ignored; otherwise returns a (possibly
// empty) mapping of endpoint names to URLs.
NET_EXPORT
std::optional<base::flat_map<std::string, std::string>> ParseReportingEndpoints(
    const std::string& header);

class NET_EXPORT ReportingHeaderParser {};

}  // namespace net

#endif  // NET_REPORTING_REPORTING_HEADER_PARSER_H_