#include "components/url_matcher/url_util.h"
#include <memory>
#include <string>
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/no_destructor.h"
#include "base/strings/escape.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "components/google/core/common/google_util.h"
#include "components/url_formatter/url_fixer.h"
#include "components/url_matcher/url_matcher.h"
#include "net/base/filename_util.h"
#include "net/base/url_util.h"
#include "third_party/re2/src/re2/re2.h"
#include "url/gurl.h"
URLMatcher;
URLMatcherCondition;
URLMatcherConditionFactory;
URLMatcherConditionSet;
URLMatcherPortFilter;
URLMatcherSchemeFilter;
URLQueryElementMatcherCondition;
namespace url_matcher {
namespace util {
namespace {
const char kGoogleAmpCacheHost[] = …;
const char kGoogleAmpCachePathPattern[] = …;
const char kGoogleAmpViewerPathPattern[] = …;
const char kGoogleWebCacheHost[] = …;
const char kGoogleWebCachePathPrefix[] = …;
const char kGoogleWebCacheQueryPattern[] = …;
const char kGoogleTranslateSubdomain[] = …;
const char kAlternateGoogleTranslateHost[] = …;
const size_t kMaxFiltersAllowed = …;
GURL BuildURL(bool is_https, const std::string& host_and_path) { … }
void ProcessQueryToConditions(
url_matcher::URLMatcherConditionFactory* condition_factory,
const std::string& query,
bool allow,
std::set<URLQueryElementMatcherCondition>* query_conditions) { … }
class EmbeddedURLExtractor { … };
}
bool GetAsStringVector(const base::Value* value,
std::vector<std::string>* out) { … }
GURL Normalize(const GURL& url) { … }
GURL GetEmbeddedURL(const GURL& url) { … }
size_t GetMaxFiltersAllowed() { … }
FilterComponents::FilterComponents() = default;
FilterComponents::~FilterComponents() = default;
FilterComponents::FilterComponents(FilterComponents&&) = default;
bool FilterComponents::IsWildcard() const { … }
scoped_refptr<URLMatcherConditionSet> CreateConditionSet(
URLMatcher* url_matcher,
base::MatcherStringPattern::ID id,
const std::string& scheme,
const std::string& host,
bool match_subdomains,
uint16_t port,
const std::string& path,
const std::string& query,
bool allow) { … }
bool FilterToComponents(const std::string& filter,
std::string* scheme,
std::string* host,
bool* match_subdomains,
uint16_t* port,
std::string* path,
std::string* query) { … }
void AddFilters(URLMatcher* matcher,
bool allow,
base::MatcherStringPattern::ID* id,
const base::Value::List& patterns,
std::map<base::MatcherStringPattern::ID,
url_matcher::util::FilterComponents>* filters) { … }
void AddFilters(URLMatcher* matcher,
bool allow,
base::MatcherStringPattern::ID* id,
const std::vector<std::string>& patterns,
std::map<base::MatcherStringPattern::ID,
url_matcher::util::FilterComponents>* filters) { … }
void AddAllowFilters(url_matcher::URLMatcher* matcher,
const base::Value::List& patterns) { … }
void AddAllowFilters(url_matcher::URLMatcher* matcher,
const std::vector<std::string>& patterns) { … }
}
}