#include "content/browser/site_info.h"
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/debug/dump_without_crashing.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/origin_agent_cluster_isolation_state.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/security/coop/cross_origin_isolation_mode.h"
#include "content/browser/site_instance_impl.h"
#include "content/browser/webui/url_data_manager_backend.h"
#include "content/common/features.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/site_isolation_policy.h"
#include "content/public/browser/storage_partition_config.h"
#include "content/public/browser/web_exposed_isolation_level.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "third_party/blink/public/common/features.h"
namespace content {
namespace {
WebUIDomains;
WebUIDomains GetWebUIDomains(const GURL& url) { … }
bool IsWebUIAndUsesTLDForProcessLockURL(const GURL& url) { … }
GURL GetProcessLockForWebUIURL(const GURL& url) { … }
GURL GetErrorPageSiteAndLockURL() { … }
GURL SchemeAndHostToSite(const std::string& scheme, const std::string& host) { … }
url::Origin GetPossiblyOverriddenOriginFromUrl(
const GURL& url,
std::optional<url::Origin> overridden_origin) { … }
bool IsOriginIsolatedSandboxedFrame(const UrlInfo& url_info) { … }
}
SiteInfo SiteInfo::CreateForErrorPage(
const StoragePartitionConfig storage_partition_config,
bool is_guest,
bool is_fenced,
const WebExposedIsolationInfo& web_exposed_isolation_info,
WebExposedIsolationLevel web_exposed_isolation_level) { … }
SiteInfo SiteInfo::CreateForDefaultSiteInstance(
const IsolationContext& isolation_context,
const StoragePartitionConfig storage_partition_config,
const WebExposedIsolationInfo& web_exposed_isolation_info) { … }
SiteInfo SiteInfo::CreateForGuest(
BrowserContext* browser_context,
const StoragePartitionConfig& partition_config) { … }
SiteInfo SiteInfo::Create(const IsolationContext& isolation_context,
const UrlInfo& url_info) { … }
SiteInfo SiteInfo::CreateOnIOThread(const IsolationContext& isolation_context,
const UrlInfo& url_info) { … }
SiteInfo SiteInfo::CreateInternal(const IsolationContext& isolation_context,
const UrlInfo& url_info,
bool compute_site_url) { … }
SiteInfo SiteInfo::CreateForTesting(const IsolationContext& isolation_context,
const GURL& url) { … }
SiteInfo::SiteInfo(
const GURL& site_url,
const GURL& process_lock_url,
bool requires_origin_keyed_process,
bool requires_origin_keyed_process_by_default,
bool is_sandboxed,
int unique_sandbox_id,
const StoragePartitionConfig storage_partition_config,
const WebExposedIsolationInfo& web_exposed_isolation_info,
WebExposedIsolationLevel web_exposed_isolation_level,
bool is_guest,
bool does_site_request_dedicated_process_for_coop,
bool is_jit_disabled,
bool are_v8_optimizations_disabled,
bool is_pdf,
bool is_fenced,
const std::optional<AgentClusterKey::CrossOriginIsolationKey>&
cross_origin_isolation_key)
: … { … }
SiteInfo::SiteInfo(const SiteInfo& rhs) = default;
SiteInfo::~SiteInfo() = default;
SiteInfo::SiteInfo(BrowserContext* browser_context)
: … { … }
auto SiteInfo::MakeSecurityPrincipalKey(const SiteInfo& site_info) { … }
SiteInfo SiteInfo::GetNonOriginKeyedEquivalentForMetrics(
const IsolationContext& isolation_context) const { … }
SiteInfo& SiteInfo::operator=(const SiteInfo& rhs) = default;
bool SiteInfo::IsSamePrincipalWith(const SiteInfo& other) const { … }
bool SiteInfo::IsExactMatch(const SiteInfo& other) const { … }
auto SiteInfo::MakeProcessLockComparisonKey() const { … }
int SiteInfo::ProcessLockCompareTo(const SiteInfo& other) const { … }
bool SiteInfo::operator==(const SiteInfo& other) const { … }
bool SiteInfo::operator!=(const SiteInfo& other) const { … }
bool SiteInfo::operator<(const SiteInfo& other) const { … }
std::string SiteInfo::GetDebugString() const { … }
std::ostream& operator<<(std::ostream& out, const SiteInfo& site_info) { … }
bool SiteInfo::RequiresDedicatedProcess(
const IsolationContext& isolation_context) const { … }
bool SiteInfo::ShouldLockProcessToSite(
const IsolationContext& isolation_context) const { … }
bool SiteInfo::ShouldUseProcessPerSite(BrowserContext* browser_context) const { … }
StoragePartitionConfig SiteInfo::GetStoragePartitionConfigForUrl(
BrowserContext* browser_context,
const GURL& site_or_regular_url) { … }
void SiteInfo::WriteIntoTrace(perfetto::TracedValue context) const { … }
bool SiteInfo::is_error_page() const { … }
GURL SiteInfo::DetermineProcessLockURL(
const IsolationContext& isolation_context,
const UrlInfo& url_info) { … }
GURL SiteInfo::GetSiteForURLInternal(const IsolationContext& isolation_context,
const UrlInfo& real_url_info,
bool should_use_effective_urls) { … }
GURL SiteInfo::GetSiteForOrigin(const url::Origin& origin) { … }
WebExposedIsolationLevel SiteInfo::ComputeWebExposedIsolationLevel(
const WebExposedIsolationInfo& web_exposed_isolation_info,
const UrlInfo& url_info) { … }
WebExposedIsolationLevel SiteInfo::ComputeWebExposedIsolationLevelForEmptySite(
const WebExposedIsolationInfo& web_exposed_isolation_info) { … }
GURL SiteInfo::GetOriginBasedSiteURLForDataURL(const url::Origin& origin) { … }
}