#include "components/privacy_sandbox/privacy_sandbox_notice_storage.h"
#include <string>
#include "base/json/values_util.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/no_destructor.h"
#include "base/strings/strcat.h"
#include "base/time/time.h"
#include "components/prefs/pref_registry.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "components/privacy_sandbox/privacy_sandbox_notice_constants.h"
namespace privacy_sandbox {
namespace {
constexpr char kPrivacySandboxNoticeDataPath[] = …;
constexpr char kPrivacySandboxSchemaVersion[] = …;
constexpr char kPrivacySandboxNoticeActionTaken[] = …;
constexpr char kPrivacySandboxNoticeActionTakenTime[] = …;
constexpr char kPrivacySandboxNoticeFirstShown[] = …;
constexpr char kPrivacySandboxNoticeLastShown[] = …;
constexpr char kPrivacySandboxNoticeShownDuration[] = …;
std::string CreatePrefPath(std::string_view notice,
std::string_view pref_name) { … }
void CreateTimingHistogram(const std::string& name, base::TimeDelta sample) { … }
std::string GetNoticeActionString(NoticeActionTaken action) { … }
void SetSchemaVersion(PrefService* pref_service, std::string_view notice) { … }
void CheckNoticeNameEligibility(std::string_view notice_name) { … }
}
PrivacySandboxNoticeData::PrivacySandboxNoticeData() = default;
PrivacySandboxNoticeData& PrivacySandboxNoticeData::operator=(
const PrivacySandboxNoticeData&) = default;
PrivacySandboxNoticeData::~PrivacySandboxNoticeData() = default;
void PrivacySandboxNoticeStorage::RegisterProfilePrefs(
PrefRegistrySimple* registry) { … }
void PrivacySandboxNoticeStorage::RecordHistogramsOnStartup(
PrefService* pref_service,
std::string_view notice) const { … }
std::optional<PrivacySandboxNoticeData>
PrivacySandboxNoticeStorage::ReadNoticeData(PrefService* pref_service,
std::string_view notice) const { … }
void PrivacySandboxNoticeStorage::SetNoticeActionTaken(
PrefService* pref_service,
std::string_view notice,
NoticeActionTaken notice_action_taken,
base::Time notice_action_taken_time) { … }
void PrivacySandboxNoticeStorage::SetNoticeShown(PrefService* pref_service,
std::string_view notice,
base::Time notice_shown_time) { … }
void PrivacySandboxNoticeStorage::MigratePrivacySandboxNoticeData(
PrefService* pref_service,
const PrivacySandboxNoticeData& input,
std::string_view notice) { … }
}