#include "services/network/public/cpp/is_potentially_trustworthy.h"
#include <iterator>
#include <optional>
#include <string_view>
#include <utility>
#include <vector>
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/no_destructor.h"
#include "base/numerics/checked_math.h"
#include "base/ranges/algorithm.h"
#include "base/sequence_checker.h"
#include "base/strings/pattern.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "net/base/ip_address.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "net/base/url_util.h"
#include "services/network/public/cpp/network_switches.h"
#include "url/origin.h"
#include "url/scheme_host_port.h"
#include "url/url_canon.h"
#include "url/url_canon_ip.h"
#include "url/url_canon_stdstring.h"
#include "url/url_constants.h"
#include "url/url_util.h"
namespace network {
namespace {
bool PatternCanMatchIpV4Host(const std::string& hostname_pattern) { … }
bool IsValidWildcardPattern(const std::string& hostname_pattern) { … }
std::string CanonicalizePatternComponents(const std::string& hostname_pattern) { … }
std::vector<std::string> CanonicalizeAllowlist(
const std::vector<std::string>& origins_and_patterns_list,
std::vector<std::string>* rejected_patterns) { … }
std::vector<std::string> ParseSecureOriginAllowlist(
const std::string& origins_str,
std::vector<std::string>* rejected_patterns = nullptr) { … }
std::vector<std::string> ParseSecureOriginAllowlistFromCmdline() { … }
bool IsAllowlisted(const std::vector<std::string>& allowlist,
const url::Origin& origin) { … }
bool IsSchemeConsideredAuthenticated(std::string_view scheme) { … }
}
bool IsOriginPotentiallyTrustworthy(const url::Origin& origin) { … }
bool IsUrlPotentiallyTrustworthy(const GURL& url) { … }
SecureOriginAllowlist& SecureOriginAllowlist::GetInstance() { … }
std::vector<std::string> SecureOriginAllowlist::GetCurrentAllowlist() { … }
void SecureOriginAllowlist::SetAuxiliaryAllowlist(
const std::string& auxiliary_allowlist,
std::vector<std::string>* rejected_patterns) { … }
void SecureOriginAllowlist::ResetForTesting() { … }
bool SecureOriginAllowlist::IsOriginAllowlisted(const url::Origin& origin) { … }
std::vector<std::string> SecureOriginAllowlist::CanonicalizeAllowlistForTesting(
const std::vector<std::string>& allowlist,
std::vector<std::string>* rejected_patterns) { … }
SecureOriginAllowlist::SecureOriginAllowlist() = default;
void SecureOriginAllowlist::ParseCmdlineIfNeeded() { … }
}