#include "content/browser/browsing_data/browsing_data_filter_builder_impl.h"
#include <string>
#include <vector>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/notreached.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "services/network/public/mojom/clear_data_filter.mojom.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "url/origin.h"
GetDomainAndRegistry;
INCLUDE_PRIVATE_REGISTRIES;
OriginMatchingMode;
namespace content {
namespace {
bool IsSubdomainOfARegistrableDomain(const std::string& domain) { … }
bool MatchesStorageKey(const std::set<url::Origin>& origins,
const std::set<std::string>& registerable_domains,
BrowsingDataFilterBuilder::Mode mode,
BrowsingDataFilterBuilder::OriginMatchingMode match_mode,
const blink::StorageKey& storage_key) { … }
bool MatchesURL(const std::set<url::Origin>& origins,
const std::set<std::string>& registerable_domains,
BrowsingDataFilterBuilder::Mode mode,
BrowsingDataFilterBuilder::OriginMatchingMode origin_mode,
bool partitioned_cookies_only,
const GURL& url) { … }
bool MatchesPluginSiteForRegisterableDomainsAndIPs(
const std::set<std::string>& domains_and_ips,
BrowsingDataFilterBuilder::Mode mode,
const std::string& site) { … }
template <typename T>
base::RepeatingCallback<bool(const T&)> NotReachedFilter() { … }
bool StorageKeyInCookiePartitionKeyCollection(
const blink::StorageKey& storage_key,
const net::CookiePartitionKeyCollection& cookie_partition_key_collection) { … }
}
std::unique_ptr<BrowsingDataFilterBuilder>
BrowsingDataFilterBuilder::Create(Mode mode) { … }
std::unique_ptr<BrowsingDataFilterBuilder> BrowsingDataFilterBuilder::Create(
Mode mode,
OriginMatchingMode origin_mode) { … }
base::RepeatingCallback<bool(const GURL&)>
BrowsingDataFilterBuilder::BuildNoopFilter() { … }
BrowsingDataFilterBuilderImpl::BrowsingDataFilterBuilderImpl(Mode mode)
: … { … }
BrowsingDataFilterBuilderImpl::BrowsingDataFilterBuilderImpl(
Mode mode,
OriginMatchingMode origin_mode)
: … { … }
BrowsingDataFilterBuilderImpl::~BrowsingDataFilterBuilderImpl() { … }
void BrowsingDataFilterBuilderImpl::AddOrigin(const url::Origin& origin) { … }
void BrowsingDataFilterBuilderImpl::AddRegisterableDomain(
const std::string& domain) { … }
void BrowsingDataFilterBuilderImpl::SetCookiePartitionKeyCollection(
const net::CookiePartitionKeyCollection& cookie_partition_key_collection) { … }
void BrowsingDataFilterBuilderImpl::SetStorageKey(
const std::optional<blink::StorageKey>& storage_key) { … }
bool BrowsingDataFilterBuilderImpl::HasStorageKey() const { … }
bool BrowsingDataFilterBuilderImpl::MatchesWithSavedStorageKey(
const blink::StorageKey& other_key) const { … }
bool BrowsingDataFilterBuilderImpl::MatchesAllOriginsAndDomains() { … }
bool BrowsingDataFilterBuilderImpl::MatchesMostOriginsAndDomains() { … }
bool BrowsingDataFilterBuilderImpl::MatchesNothing() { … }
void BrowsingDataFilterBuilderImpl::SetPartitionedCookiesOnly(bool value) { … }
bool BrowsingDataFilterBuilderImpl::PartitionedCookiesOnly() const { … }
void BrowsingDataFilterBuilderImpl::SetStoragePartitionConfig(
const StoragePartitionConfig& storage_partition_config) { … }
std::optional<StoragePartitionConfig>
BrowsingDataFilterBuilderImpl::GetStoragePartitionConfig() { … }
base::RepeatingCallback<bool(const GURL&)>
BrowsingDataFilterBuilderImpl::BuildUrlFilter() { … }
content::StoragePartition::StorageKeyMatcherFunction
BrowsingDataFilterBuilderImpl::BuildStorageKeyFilter() { … }
network::mojom::ClearDataFilterPtr
BrowsingDataFilterBuilderImpl::BuildNetworkServiceFilter() { … }
network::mojom::CookieDeletionFilterPtr
BrowsingDataFilterBuilderImpl::BuildCookieDeletionFilter() { … }
base::RepeatingCallback<bool(const std::string& site)>
BrowsingDataFilterBuilderImpl::BuildPluginFilter() { … }
BrowsingDataFilterBuilderImpl::Mode BrowsingDataFilterBuilderImpl::GetMode() { … }
BrowsingDataFilterBuilderImpl::OriginMatchingMode
BrowsingDataFilterBuilderImpl::GetOriginModeForTesting() const { … }
const std::set<url::Origin>& BrowsingDataFilterBuilderImpl::GetOrigins() const { … }
const std::set<std::string>&
BrowsingDataFilterBuilderImpl::GetRegisterableDomains() const { … }
const net::CookiePartitionKeyCollection&
BrowsingDataFilterBuilderImpl::GetCookiePartitionKeyCollectionForTesting()
const { … }
std::unique_ptr<BrowsingDataFilterBuilder>
BrowsingDataFilterBuilderImpl::Copy() { … }
bool BrowsingDataFilterBuilderImpl::IsEqual(
const BrowsingDataFilterBuilder& other) const { … }
}