#include "chrome/browser/privacy_sandbox/privacy_sandbox_settings_delegate.h"
#include <memory>
#include <utility>
#include "base/check.h"
#include "base/feature_list.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "build/buildflag.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/privacy_sandbox/privacy_sandbox_notice_confirmation.h"
#include "chrome/browser/privacy_sandbox/tracking_protection_onboarding_factory.h"
#include "chrome/browser/privacy_sandbox/tracking_protection_settings_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/tpcd/experiment/experiment_manager.h"
#include "chrome/browser/tpcd/experiment/tpcd_experiment_features.h"
#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/pref_names.h"
#include "components/metrics/metrics_pref_names.h"
#include "components/prefs/pref_service.h"
#include "components/privacy_sandbox/privacy_sandbox_features.h"
#include "components/privacy_sandbox/privacy_sandbox_prefs.h"
#include "components/privacy_sandbox/tpcd_experiment_eligibility.h"
#include "components/privacy_sandbox/tracking_protection_onboarding.h"
#include "components/privacy_sandbox/tracking_protection_settings.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/signin/public/identity_manager/tribool.h"
#include "content/public/common/content_features.h"
#include "net/cookies/cookie_util.h"
#if BUILDFLAG(IS_ANDROID)
#include "chrome/browser/android/webapps/webapp_registry.h"
#endif
namespace {
TpcdExperimentEligibility;
signin::Tribool GetPrivacySandboxRestrictedByAccountCapability(
signin::IdentityManager* identity_manager) { … }
const base::FeatureParam<bool> kCookieDeprecationUseProfileFiltering{ … };
}
PrivacySandboxSettingsDelegate::PrivacySandboxSettingsDelegate(
Profile* profile,
tpcd::experiment::ExperimentManager* experiment_manager)
: … { … }
PrivacySandboxSettingsDelegate::~PrivacySandboxSettingsDelegate() = default;
bool PrivacySandboxSettingsDelegate::IsRestrictedNoticeEnabled() const { … }
bool PrivacySandboxSettingsDelegate::IsPrivacySandboxRestricted() const { … }
bool PrivacySandboxSettingsDelegate::IsPrivacySandboxCurrentlyUnrestricted()
const { … }
bool PrivacySandboxSettingsDelegate::IsSubjectToM1NoticeRestricted() const { … }
bool PrivacySandboxSettingsDelegate::IsIncognitoProfile() const { … }
bool PrivacySandboxSettingsDelegate::HasAppropriateTopicsConsent() const { … }
bool PrivacySandboxSettingsDelegate::PrivacySandboxRestrictedNoticeRequired()
const { … }
bool PrivacySandboxSettingsDelegate::IsCookieDeprecationExperimentEligible()
const { … }
TpcdExperimentEligibility PrivacySandboxSettingsDelegate::
GetCookieDeprecationExperimentCurrentEligibility() const { … }
bool PrivacySandboxSettingsDelegate::IsSubjectToEnterprisePolicies() const { … }
#if BUILDFLAG(IS_ANDROID)
void PrivacySandboxSettingsDelegate::OverrideWebappRegistryForTesting(
std::unique_ptr<WebappRegistry> webapp_registry) {
DCHECK(webapp_registry);
webapp_registry_ = std::move(webapp_registry);
}
#endif
bool PrivacySandboxSettingsDelegate::IsCookieDeprecationLabelAllowed() const { … }
bool PrivacySandboxSettingsDelegate::
AreThirdPartyCookiesBlockedByCookieDeprecationExperiment() const { … }