#include "components/affiliations/core/browser/affiliation_utils.h"
#include <map>
#include <ostream>
#include <string_view>
#include "base/base64.h"
#include "base/ranges/algorithm.h"
#include "base/strings/escape.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "components/url_formatter/elide_url.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "url/third_party/mozilla/url_parse.h"
#include "url/url_canon_stdstring.h"
namespace affiliations {
namespace {
const char kAndroidAppScheme[] = …;
std::string_view ComponentString(const std::string& uri,
const url::Component& component) { … }
bool ContainsOnlyAlphanumericAnd(std::string_view input,
std::string_view other_characters) { … }
bool CanonicalizeWebFacetURI(const std::string& input_uri,
const url::Parsed& input_parsed,
std::string* canonical_uri) { … }
bool CanonicalizeBase64Padding(std::string* data) { … }
bool CanonicalizeHashComponent(std::string_view input_hash,
url::CanonOutput* canonical_output) { … }
bool CanonicalizePackageNameComponent(
std::string_view input_package_name,
url::CanonOutput* canonical_output) { … }
bool CanonicalizeAndroidFacetURI(const std::string& input_uri,
const url::Parsed& input_parsed,
std::string* canonical_uri) { … }
bool ParseAndCanonicalizeFacetURI(const std::string& input_uri,
std::string* canonical_uri) { … }
std::vector<FacetURI> ExtractAndSortFacetURIs(const AffiliatedFacets& facets) { … }
void IncreaseDomainLevel(const std::string& full_domain,
std::string& main_domain) { … }
class DisjointSet { … };
}
FacetURI::FacetURI() = default;
FacetURI FacetURI::FromPotentiallyInvalidSpec(const std::string& spec) { … }
FacetURI FacetURI::FromCanonicalSpec(const std::string& canonical_spec) { … }
bool FacetURI::IsValidWebFacetURI() const { … }
bool FacetURI::IsValidAndroidFacetURI() const { … }
std::string FacetURI::scheme() const { … }
std::string FacetURI::android_package_name() const { … }
std::string FacetURI::GetAndroidPackageDisplayName() const { … }
FacetURI::FacetURI(const std::string& canonical_spec, bool is_valid)
: … { … }
Facet::Facet(FacetURI uri,
FacetBrandingInfo branding_info,
GURL change_password_url,
std::string main_domain)
: … { … }
Facet::~Facet() = default;
Facet::Facet(const Facet& other) = default;
Facet::Facet(Facet&& other) = default;
Facet& Facet::operator=(const Facet& other) = default;
Facet& Facet::operator=(Facet&& other) = default;
GroupedFacets::GroupedFacets() = default;
GroupedFacets::~GroupedFacets() = default;
GroupedFacets::GroupedFacets(const GroupedFacets& other) = default;
GroupedFacets::GroupedFacets(GroupedFacets&& other) = default;
GroupedFacets& GroupedFacets::operator=(const GroupedFacets& other) = default;
GroupedFacets& GroupedFacets::operator=(GroupedFacets&& other) = default;
std::vector<GroupedFacets> MergeRelatedGroups(
const base::flat_set<std::string>& psl_extensions,
const std::vector<GroupedFacets>& groups) { … }
AffiliatedFacetsWithUpdateTime::AffiliatedFacetsWithUpdateTime() = default;
AffiliatedFacetsWithUpdateTime::AffiliatedFacetsWithUpdateTime(
const AffiliatedFacetsWithUpdateTime& other) = default;
AffiliatedFacetsWithUpdateTime::AffiliatedFacetsWithUpdateTime(
AffiliatedFacetsWithUpdateTime&& other) = default;
AffiliatedFacetsWithUpdateTime& AffiliatedFacetsWithUpdateTime::operator=(
const AffiliatedFacetsWithUpdateTime& other) = default;
AffiliatedFacetsWithUpdateTime& AffiliatedFacetsWithUpdateTime::operator=(
AffiliatedFacetsWithUpdateTime&& other) = default;
AffiliatedFacetsWithUpdateTime::~AffiliatedFacetsWithUpdateTime() = default;
std::ostream& operator<<(std::ostream& os, const FacetURI& facet_uri) { … }
bool operator==(const FacetBrandingInfo& lhs, const FacetBrandingInfo& rhs) { … }
bool operator!=(const FacetBrandingInfo& lhs, const FacetBrandingInfo& rhs) { … }
bool operator==(const Facet& lhs, const Facet& rhs) { … }
bool operator!=(const Facet& lhs, const Facet& rhs) { … }
bool operator==(const GroupedFacets& lhs, const GroupedFacets& rhs) { … }
bool operator!=(const GroupedFacets& lhs, const GroupedFacets& rhs) { … }
bool AreEquivalenceClassesEqual(const AffiliatedFacets& a,
const AffiliatedFacets& b) { … }
bool IsValidAndroidFacetURI(const std::string& url) { … }
std::string GetExtendedTopLevelDomain(
const GURL& url,
const base::flat_set<std::string>& psl_extensions) { … }
bool IsExtendedPublicSuffixDomainMatch(
const GURL& url1,
const GURL& url2,
const base::flat_set<std::string>& psl_extensions) { … }
}