#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "extensions/common/url_pattern.h"
#include <stddef.h>
#include <ostream>
#include <string_view>
#include "base/containers/contains.h"
#include "base/strings/pattern.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 "content/public/common/url_constants.h"
#include "extensions/common/constants.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "net/base/url_util.h"
#include "url/gurl.h"
#include "url/url_util.h"
const char URLPattern::kAllUrlsPattern[] = …;
namespace {
const char* const kValidSchemes[] = …;
const int kValidSchemeMasks[] = …;
static_assert …;
const char kParseSuccess[] = …;
const char kParseErrorMissingSchemeSeparator[] = …;
const char kParseErrorInvalidScheme[] = …;
const char kParseErrorWrongSchemeType[] = …;
const char kParseErrorEmptyHost[] = …;
const char kParseErrorInvalidHostWildcard[] = …;
const char kParseErrorEmptyPath[] = …;
const char kParseErrorInvalidPort[] = …;
const char kParseErrorInvalidHost[] = …;
const char* const kParseResultMessages[] = …;
static_assert …;
const char kPathSeparator[] = …;
bool IsStandardScheme(std::string_view scheme) { … }
bool IsValidPortForScheme(std::string_view scheme, std::string_view port) { … }
std::string_view StripTrailingWildcard(std::string_view path) { … }
std::string_view CanonicalizeHostForMatching(std::string_view host_piece) { … }
}
bool URLPattern::IsValidSchemeForExtensions(std::string_view scheme) { … }
int URLPattern::GetValidSchemeMaskForExtensions() { … }
URLPattern::URLPattern()
: … { … }
URLPattern::URLPattern(int valid_schemes)
: … { … }
URLPattern::URLPattern(int valid_schemes, std::string_view pattern)
: … { … }
URLPattern::URLPattern(const URLPattern& other) = default;
URLPattern::URLPattern(URLPattern&& other) = default;
URLPattern::~URLPattern() = default;
URLPattern& URLPattern::operator=(const URLPattern& other) = default;
URLPattern& URLPattern::operator=(URLPattern&& other) = default;
bool URLPattern::operator<(const URLPattern& other) const { … }
bool URLPattern::operator>(const URLPattern& other) const { … }
bool URLPattern::operator==(const URLPattern& other) const { … }
std::ostream& operator<<(std::ostream& out, const URLPattern& url_pattern) { … }
URLPattern::ParseResult URLPattern::Parse(std::string_view pattern) { … }
void URLPattern::SetValidSchemes(int valid_schemes) { … }
void URLPattern::SetHost(std::string_view host) { … }
void URLPattern::SetMatchAllURLs(bool val) { … }
void URLPattern::SetMatchSubdomains(bool val) { … }
bool URLPattern::SetScheme(std::string_view scheme) { … }
bool URLPattern::IsValidScheme(std::string_view scheme) const { … }
void URLPattern::SetPath(std::string_view path) { … }
bool URLPattern::SetPort(std::string_view port) { … }
bool URLPattern::MatchesURL(const GURL& test) const { … }
bool URLPattern::MatchesSecurityOrigin(const GURL& test) const { … }
bool URLPattern::MatchesScheme(std::string_view test) const { … }
bool URLPattern::MatchesHost(std::string_view host) const { … }
bool URLPattern::MatchesHost(const GURL& test) const { … }
bool URLPattern::MatchesEffectiveTld(
net::registry_controlled_domains::PrivateRegistryFilter private_filter,
net::registry_controlled_domains::UnknownRegistryFilter unknown_filter)
const { … }
bool URLPattern::MatchesSingleOrigin() const { … }
bool URLPattern::MatchesPath(std::string_view test) const { … }
const std::string& URLPattern::GetAsString() const { … }
bool URLPattern::OverlapsWith(const URLPattern& other) const { … }
bool URLPattern::Contains(const URLPattern& other) const { … }
std::optional<URLPattern> URLPattern::CreateIntersection(
const URLPattern& other) const { … }
bool URLPattern::MatchesAnyScheme(
const std::vector<std::string>& schemes) const { … }
bool URLPattern::MatchesAllSchemes(
const std::vector<std::string>& schemes) const { … }
bool URLPattern::MatchesSecurityOriginHelper(const GURL& test) const { … }
bool URLPattern::MatchesPortPattern(std::string_view port) const { … }
std::vector<std::string> URLPattern::GetExplicitSchemes() const { … }
std::vector<URLPattern> URLPattern::ConvertToExplicitSchemes() const { … }
const char* URLPattern::GetParseResultString(
URLPattern::ParseResult parse_result) { … }