#include "content/browser/first_party_sets/first_party_set_parser.h"
#include <cstdint>
#include <iterator>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "base/check_op.h"
#include "base/containers/contains.h"
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
#include "base/json/json_reader.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_util.h"
#include "base/types/expected.h"
#include "base/types/expected_macros.h"
#include "base/values.h"
#include "content/browser/first_party_sets/first_party_sets_overrides_policy.h"
#include "content/public/browser/first_party_sets_handler.h"
#include "content/public/common/content_features.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "net/base/schemeful_site.h"
#include "net/first_party_sets/first_party_set_entry.h"
#include "net/first_party_sets/global_first_party_sets.h"
#include "net/first_party_sets/local_set_declaration.h"
#include "net/first_party_sets/sets_mutation.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace content {
namespace {
ParseErrorType;
ParseWarningType;
ParseError;
ParseWarning;
SetsMap;
Aliases;
SetsAndAliases;
SingleSet;
constexpr char kFirstPartySetPrimaryField[] = …;
constexpr char kFirstPartySetAssociatedSitesField[] = …;
constexpr char kFirstPartySetServiceSitesField[] = …;
constexpr char kCCTLDsField[] = …;
constexpr char kFirstPartySetPolicyReplacementsField[] = …;
constexpr char kFirstPartySetPolicyAdditionsField[] = …;
constexpr int kFirstPartySetsMaxAssociatedSites = …;
enum class PolicySetType { … };
const char* SetTypeToString(PolicySetType set_type) { … }
class ValidateSiteResult { … };
bool IsFatalError(ParseErrorType error_type) { … }
struct SubsetDescriptor { … };
bool IsSingletonSet(const std::vector<SetsMap::value_type>& set_entries,
const Aliases& aliases) { … }
std::optional<std::string> RemoveTldFromSite(const net::SchemefulSite& site) { … }
struct ParsedPolicySetLists { … };
class ParseContext { … };
SetsAndAliases ParseSetsFromStreamInternal(std::istream& input,
bool emit_errors,
bool emit_metrics) { … }
}
std::optional<net::SchemefulSite>
FirstPartySetParser::CanonicalizeRegisteredDomain(
const std::string_view origin_string,
bool emit_errors) { … }
net::GlobalFirstPartySets FirstPartySetParser::ParseSetsFromStream(
std::istream& input,
base::Version version,
bool emit_errors,
bool emit_metrics) { … }
FirstPartySetParser::PolicyParseResult
FirstPartySetParser::ParseSetsFromEnterprisePolicy(
const base::Value::Dict& policy) { … }
net::LocalSetDeclaration FirstPartySetParser::ParseFromCommandLine(
const std::string& switch_value) { … }
}