#include "chrome/browser/browsing_data/chrome_browsing_data_model_delegate.h"
#include <memory>
#include "base/barrier_callback.h"
#include "base/functional/callback_helpers.h"
#include "base/functional/concurrent_callbacks.h"
#include "base/functional/concurrent_closures.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
#include "chrome/browser/browsing_topics/browsing_topics_service_factory.h"
#include "chrome/browser/media/webrtc/media_device_salt_service_factory.h"
#include "chrome/browser/webid/federated_identity_permission_context.h"
#include "chrome/browser/webid/federated_identity_permission_context_factory.h"
#include "components/browsing_topics/browsing_topics_service.h"
#include "components/content_settings/browser/page_specific_content_settings.h"
#include "components/media_device_salt/media_device_salt_service.h"
#include "components/permissions/permissions_client.h"
#include "components/supervised_user/core/common/features.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/storage_partition_config.h"
#include "url/origin.h"
#if !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/browsing_data/chrome_browsing_data_remover_constants.h"
#include "chrome/browser/web_applications/isolated_web_apps/remove_isolated_web_app_data.h"
#include "chrome/browser/web_applications/web_app_command_scheduler.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#endif
namespace {
#if !BUILDFLAG(IS_ANDROID)
std::vector<ChromeBrowsingDataModelDelegate::DelegateEntry>
IsolatedWebAppBrowsingDataToDelegateEntries(
base::flat_map<url::Origin, int64_t> isolated_web_app_browsing_data) { … }
#endif
std::vector<ChromeBrowsingDataModelDelegate::DelegateEntry>
FlattenDelegateEntries(
std::vector<std::vector<ChromeBrowsingDataModelDelegate::DelegateEntry>>
entries) { … }
}
std::unique_ptr<ChromeBrowsingDataModelDelegate>
ChromeBrowsingDataModelDelegate::CreateForProfile(Profile* profile) { … }
std::unique_ptr<ChromeBrowsingDataModelDelegate>
ChromeBrowsingDataModelDelegate::CreateForStoragePartition(
Profile* profile,
content::StoragePartition* storage_partition) { … }
void ChromeBrowsingDataModelDelegate::BrowsingDataAccessed(
content::RenderFrameHost* rfh,
const BrowsingDataModel::DataKey& data_key,
StorageType storage_type,
bool blocked) { … }
ChromeBrowsingDataModelDelegate::ChromeBrowsingDataModelDelegate(
Profile* profile,
content::StoragePartition* storage_partition)
: … { … }
ChromeBrowsingDataModelDelegate::~ChromeBrowsingDataModelDelegate() = default;
void ChromeBrowsingDataModelDelegate::GetAllDataKeys(
base::OnceCallback<void(std::vector<DelegateEntry>)> callback) { … }
void ChromeBrowsingDataModelDelegate::RemoveDataKey(
const BrowsingDataModel::DataKey& data_key,
BrowsingDataModel::StorageTypeSet storage_types,
base::OnceClosure callback) { … }
std::optional<BrowsingDataModel::DataOwner>
ChromeBrowsingDataModelDelegate::GetDataOwner(
const BrowsingDataModel::DataKey& data_key,
BrowsingDataModel::StorageType storage_type) const { … }
std::optional<bool> ChromeBrowsingDataModelDelegate::IsStorageTypeCookieLike(
BrowsingDataModel::StorageType storage_type) const { … }
std::optional<bool>
ChromeBrowsingDataModelDelegate::IsBlockedByThirdPartyCookieBlocking(
const BrowsingDataModel::DataKey& data_key,
BrowsingDataModel::StorageType storage_type) const { … }
bool ChromeBrowsingDataModelDelegate::IsCookieDeletionDisabled(
const GURL& url) { … }
base::WeakPtr<BrowsingDataModel::Delegate>
ChromeBrowsingDataModelDelegate::AsWeakPtr() { … }
void ChromeBrowsingDataModelDelegate::GetAllMediaDeviceSaltDataKeys(
base::OnceCallback<void(std::vector<DelegateEntry>)> callback,
std::vector<DelegateEntry> entries) { … }
void ChromeBrowsingDataModelDelegate::GotAllMediaDeviceSaltDataKeys(
base::OnceCallback<void(std::vector<DelegateEntry>)> callback,
std::vector<DelegateEntry> entries,
std::vector<blink::StorageKey> storage_keys) { … }
void ChromeBrowsingDataModelDelegate::RemoveMediaDeviceSalt(
const blink::StorageKey& storage_key,
base::OnceClosure callback) { … }
void ChromeBrowsingDataModelDelegate::GetAllFederatedIdentityDataKeys(
base::OnceCallback<void(std::vector<DelegateEntry>)> callback,
std::vector<DelegateEntry> entries) { … }
void ChromeBrowsingDataModelDelegate::GotAllFederatedIdentityDataKeys(
base::OnceCallback<void(std::vector<DelegateEntry>)> callback,
std::vector<DelegateEntry> entries,
std::vector<webid::FederatedIdentityDataModel::DataKey> data_keys) { … }
void ChromeBrowsingDataModelDelegate::RemoveFederatedIdentityData(
const webid::FederatedIdentityDataModel::DataKey& data_key,
base::OnceClosure callback) { … }