#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "services/network/cookie_manager.h"
#include <optional>
#include <utility>
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/process/process.h"
#include "base/threading/platform_thread.h"
#include "build/build_config.h"
#include "components/content_settings/core/common/content_settings_pattern.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "net/cookies/canonical_cookie.h"
#include "net/cookies/cookie_constants.h"
#include "net/cookies/cookie_monster.h"
#include "net/cookies/cookie_options.h"
#include "net/cookies/cookie_partition_key.h"
#include "net/cookies/cookie_store.h"
#include "net/cookies/cookie_util.h"
#include "net/url_request/url_request_context.h"
#include "services/network/cookie_access_delegate_impl.h"
#include "services/network/session_cleanup_cookie_store.h"
#include "services/network/tpcd/metadata/manager.h"
#include "url/gurl.h"
CookieDeletionInfo;
CookieDeleteSessionControl;
namespace network {
namespace {
CookiePartitionKeyPairCallback;
bool g_crash_on_get_cookie_list = …;
}
CookieManager::ListenerRegistration::ListenerRegistration() = default;
CookieManager::ListenerRegistration::~ListenerRegistration() = default;
void CookieManager::ListenerRegistration::DispatchCookieStoreChange(
const net::CookieChangeInfo& change) { … }
CookieManager::CookieManager(
net::URLRequestContext* url_request_context,
FirstPartySetsAccessDelegate* const first_party_sets_access_delegate,
scoped_refptr<SessionCleanupCookieStore> session_cleanup_cookie_store,
mojom::CookieManagerParamsPtr params,
network::tpcd::metadata::Manager* tpcd_metadata_manager)
: … { … }
CookieManager::~CookieManager() { … }
void CookieManager::AddSettingsWillChangeCallback(
SettingsChangeCallback callback) { … }
void CookieManager::AddReceiver(
mojo::PendingReceiver<mojom::CookieManager> receiver) { … }
void CookieManager::GetAllCookies(GetAllCookiesCallback callback) { … }
void CookieManager::GetAllCookiesWithAccessSemantics(
GetAllCookiesWithAccessSemanticsCallback callback) { … }
void CookieManager::GetCookieList(
const GURL& url,
const net::CookieOptions& cookie_options,
const net::CookiePartitionKeyCollection& cookie_partition_key_collection,
GetCookieListCallback callback) { … }
void CookieManager::SetCanonicalCookie(const net::CanonicalCookie& cookie,
const GURL& source_url,
const net::CookieOptions& cookie_options,
SetCanonicalCookieCallback callback) { … }
void CookieManager::DeleteCanonicalCookie(
const net::CanonicalCookie& cookie,
DeleteCanonicalCookieCallback callback) { … }
void CookieManager::SetContentSettings(
ContentSettingsType content_settings_type,
const ContentSettingsForOneType& settings,
SetContentSettingsCallback callback) { … }
void CookieManager::DeleteCookies(mojom::CookieDeletionFilterPtr filter,
DeleteCookiesCallback callback) { … }
void CookieManager::DeleteSessionOnlyCookies(
DeleteSessionOnlyCookiesCallback callback) { … }
void CookieManager::DeleteStaleSessionOnlyCookies(
DeleteStaleSessionOnlyCookiesCallback callback) { … }
void CookieManager::AddCookieChangeListener(
const GURL& url,
const std::optional<std::string>& name,
mojo::PendingRemote<mojom::CookieChangeListener> listener) { … }
void CookieManager::AddGlobalChangeListener(
mojo::PendingRemote<mojom::CookieChangeListener> listener) { … }
void CookieManager::RemoveChangeListener(ListenerRegistration* registration) { … }
void CookieManager::CloneInterface(
mojo::PendingReceiver<mojom::CookieManager> new_interface) { … }
void CookieManager::SetPreCommitCallbackDelayForTesting(base::TimeDelta delay) { … }
void CookieManager::FlushCookieStore(FlushCookieStoreCallback callback) { … }
void CookieManager::AllowFileSchemeCookies(
bool allow,
AllowFileSchemeCookiesCallback callback) { … }
void CookieManager::SetForceKeepSessionState() { … }
void CookieManager::BlockThirdPartyCookies(bool block) { … }
void CookieManager::SetMitigationsEnabledFor3pcd(bool enable) { … }
void CookieManager::SetTrackingProtectionEnabledFor3pcd(bool enable) { … }
void CookieManager::OnSettingsWillChange() { … }
void CookieManager::ConfigureCookieSettings(
const network::mojom::CookieManagerParams& params,
CookieSettings* out) { … }
void CookieManager::CrashOnGetCookieList() { … }
CookieDeletionInfo DeletionFilterToInfo(mojom::CookieDeletionFilterPtr filter) { … }
}