#include "components/browsing_topics/browsing_topics_state.h"
#include "base/base64.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/json/json_file_value_serializer.h"
#include "base/json/json_writer.h"
#include "base/json/values_util.h"
#include "base/metrics/histogram_functions.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "components/browsing_topics/common/common_types.h"
#include "components/browsing_topics/util.h"
#include "third_party/blink/public/common/features.h"
namespace browsing_topics {
namespace {
const base::TimeDelta kSaveDelay = …;
const char kEpochsNameKey[] = …;
const char kNextScheduledCalculationTimeNameKey[] = …;
const char kHexEncodedHmacKeyNameKey[] = …;
std::unique_ptr<BrowsingTopicsState::LoadResult> LoadFileOnBackendTaskRunner(
const base::FilePath& file_path) { … }
bool AreConfigVersionsCompatible(int preexisting, int current) { … }
}
BrowsingTopicsState::LoadResult::LoadResult(bool file_exists,
std::unique_ptr<base::Value> value)
: … { … }
BrowsingTopicsState::LoadResult::~LoadResult() = default;
BrowsingTopicsState::BrowsingTopicsState(const base::FilePath& profile_path,
base::OnceClosure loaded_callback)
: … { … }
BrowsingTopicsState::~BrowsingTopicsState() { … }
void BrowsingTopicsState::ClearAllTopics() { … }
void BrowsingTopicsState::ClearOneEpoch(size_t epoch_index) { … }
void BrowsingTopicsState::ClearTopic(Topic topic) { … }
void BrowsingTopicsState::ClearContextDomain(
const HashedDomain& hashed_context_domain) { … }
std::optional<EpochTopics> BrowsingTopicsState::AddEpoch(
EpochTopics epoch_topics) { … }
void BrowsingTopicsState::UpdateNextScheduledCalculationTime(
base::TimeDelta delay) { … }
std::vector<const EpochTopics*> BrowsingTopicsState::EpochsForSite(
const std::string& top_domain) const { … }
bool BrowsingTopicsState::HasScheduledSaveForTesting() const { … }
base::TimeDelta BrowsingTopicsState::CalculateSiteStickyTimeDelta(
const std::string& top_domain) const { … }
base::ImportantFileWriter::BackgroundDataProducerCallback
BrowsingTopicsState::GetSerializedDataProducerForBackgroundSequence() { … }
base::Value::Dict BrowsingTopicsState::ToDictValue() const { … }
void BrowsingTopicsState::ScheduleSave() { … }
void BrowsingTopicsState::DidLoadFile(base::OnceClosure loaded_callback,
std::unique_ptr<LoadResult> load_result) { … }
BrowsingTopicsState::ParseResult BrowsingTopicsState::ParseValue(
const base::Value& value) { … }
}