#include "components/tpcd/metadata/browser/manager.h"
#include <cstdint>
#include <memory>
#include <random>
#include <string>
#include <utility>
#include "base/base64.h"
#include "base/check.h"
#include "base/containers/flat_map.h"
#include "base/hash/sha1.h"
#include "base/metrics/histogram_functions.h"
#include "base/no_destructor.h"
#include "base/rand_util.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_enums.mojom-shared.h"
#include "components/content_settings/core/common/content_settings_rules.h"
#include "components/content_settings/core/common/content_settings_utils.h"
#include "components/content_settings/core/common/features.h"
#include "components/content_settings/core/common/host_indexed_content_settings.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "components/tpcd/metadata/browser/parser.h"
#include "components/tpcd/metadata/browser/prefs.h"
#include "components/tpcd/metadata/common/proto/metadata.pb.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
namespace tpcd::metadata {
namespace {
uint32_t ElectedDtrp(const MetadataEntry& metadata_entry) { … }
}
Manager* Manager::GetInstance(Parser* parser, Delegate& delegate) { … }
Manager::Manager(Parser* parser, Delegate& delegate)
: … { … }
Manager::~Manager() { … }
uint32_t Manager::RandGenerator::Generate() const { … }
bool Manager::IsAllowed(const GURL& url,
const GURL& first_party_url,
content_settings::SettingInfo* out_info) const { … }
void Manager::SetGrants(const ContentSettingsForOneType& grants) { … }
ContentSettingsForOneType Manager::BuildGrantsWithPredicate(
base::FunctionRef<bool(const MetadataEntry&)> predicate) { … }
void Manager::OnMetadataReady() { … }
ContentSettingsForOneType Manager::GetGrants() const { … }
void Manager::ResetCohorts() { … }
namespace helpers {
std::string GenerateKeyHash(const MetadataEntry& metadata_entry) { … }
void WriteCohortDistributionMetrics(
const content_settings::mojom::TpcdMetadataCohort& cohort) { … }
}
}