#include "components/ip_protection/common/url_matcher_with_bypass.h"
#include <memory>
#include <string>
#include <string_view>
#include <utility>
#include "base/check.h"
#include "base/logging.h"
#include "base/notreached.h"
#include "base/strings/strcat.h"
#include "base/trace_event/memory_usage_estimator.h"
#include "components/privacy_sandbox/masked_domain_list/masked_domain_list.pb.h"
#include "net/base/scheme_host_port_matcher.h"
#include "net/base/schemeful_site.h"
#include "url_matcher_with_bypass.h"
namespace ip_protection {
namespace {
bool HasSubdomainCoverage(const std::string_view domain) { … }
void AddRulesToMatcher(const std::string_view domain,
const bool include_subdomains,
net::SchemeHostPortMatcher& matcher) { … }
std::map<std::string, std::set<std::string>> PartitionDomains(
const std::set<std::string>& domains) { … }
}
std::unique_ptr<net::SchemeHostPortMatcher>
UrlMatcherWithBypass::BuildBypassMatcher(
const masked_domain_list::ResourceOwner& resource_owner) { … }
std::string UrlMatcherWithBypass::PartitionMapKey(std::string_view domain) { … }
UrlMatcherWithBypass::UrlMatcherWithBypass() = default;
UrlMatcherWithBypass::~UrlMatcherWithBypass() = default;
void UrlMatcherWithBypass::AddMaskedDomainListRules(
const std::set<std::string>& domains,
base::optional_ref<const masked_domain_list::ResourceOwner>
resource_owner) { … }
void UrlMatcherWithBypass::AddRulesWithoutBypass(
const std::set<std::string>& domains) { … }
void UrlMatcherWithBypass::Clear() { … }
size_t UrlMatcherWithBypass::EstimateMemoryUsage() const { … }
bool UrlMatcherWithBypass::IsPopulated() const { … }
UrlMatcherWithBypassResult UrlMatcherWithBypass::Matches(
const GURL& request_url,
const std::optional<net::SchemefulSite>& top_frame_site,
bool skip_bypass_check) const { … }
}