#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/google/core/common/google_util.h"
#include <stddef.h>
#include <string>
#include <string_view>
#include <vector>
#include "base/command_line.h"
#include "base/containers/fixed_flat_set.h"
#include "base/no_destructor.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "components/google/core/common/google_switches.h"
#include "components/google/core/common/google_tld_list.h"
#include "components/url_formatter/url_fixer.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "net/base/url_util.h"
#include "url/gurl.h"
namespace google_util {
namespace {
bool IsPathHomePageBase(std::string_view path) { … }
void StripTrailingDot(std::string_view* host) { … }
template <typename Container>
bool IsValidHostName(std::string_view host,
std::string_view domain_in_lower_case,
SubdomainPermission subdomain_permission,
const Container& allowed_tlds) { … }
bool IsValidURL(const GURL& url, PortPermission port_permission) { … }
bool IsCanonicalHostGoogleHostname(std::string_view canonical_host,
SubdomainPermission subdomain_permission) { … }
bool IsCanonicalHostYoutubeHostname(std::string_view canonical_host,
SubdomainPermission subdomain_permission) { … }
bool IsGoogleSearchSubdomainUrl(const GURL& url) { … }
}
const char kGoogleHomepageURL[] = …;
bool HasGoogleSearchQueryParam(std::string_view str) { … }
std::string GetGoogleLocale(const std::string& application_locale) { … }
GURL AppendGoogleLocaleParam(const GURL& url,
const std::string& application_locale) { … }
std::string GetGoogleCountryCode(const GURL& google_homepage_url) { … }
GURL GetGoogleSearchURL(const GURL& google_homepage_url) { … }
const GURL& CommandLineGoogleBaseURL() { … }
bool StartsWithCommandLineGoogleBaseURL(const GURL& url) { … }
bool IsGoogleDomainUrl(const GURL& url,
SubdomainPermission subdomain_permission,
PortPermission port_permission) { … }
bool IsGoogleHostname(std::string_view host,
SubdomainPermission subdomain_permission) { … }
bool IsGoogleHomePageUrl(const GURL& url) { … }
bool IsGoogleSearchUrl(const GURL& url) { … }
bool IsYoutubeDomainUrl(const GURL& url,
SubdomainPermission subdomain_permission,
PortPermission port_permission) { … }
bool IsGoogleAssociatedDomainUrl(const GURL& url) { … }
const std::vector<std::string>& GetGoogleRegistrableDomains() { … }
GURL AppendToAsyncQueryParam(const GURL& url,
const std::string& key,
const std::string& value) { … }
GoogleSearchMode GoogleSearchModeFromUrl(const GURL& url) { … }
}