chromium/components/tpcd/metadata/browser/manager.h

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_TPCD_METADATA_BROWSER_MANAGER_H_
#define COMPONENTS_TPCD_METADATA_BROWSER_MANAGER_H_

#include <memory>

#include "base/functional/callback_helpers.h"
#include "base/no_destructor.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/features.h"
#include "components/content_settings/core/common/host_indexed_content_settings.h"
#include "components/prefs/pref_change_registrar.h"
#include "components/prefs/pref_service.h"
#include "components/tpcd/metadata/browser/parser.h"
#include "components/tpcd/metadata/common/manager_base.h"
#include "net/base/features.h"
#include "third_party/abseil-cpp/absl/types/variant.h"

PatternSourcePredicate;

namespace tpcd::metadata {

// TODO(b/333529481): Implement an observer pattern for the Manager class
//
// The Manager class will hold the content setting generated from any installed
// TPCD Metadata component and will make it available within the browser process
// and keep a synced copy within the network process.
//
// These content setting will be used primarily by the CookieSettings classes
// and will affect cookie access decisions.
class Manager : public common::ManagerBase, public Parser::Observer {};

namespace helpers {
const char kMetadataCohortDistributionHistogram[] =;

std::string GenerateKeyHash(const MetadataEntry& metadata_entry);
void WriteCohortDistributionMetrics(
    const content_settings::mojom::TpcdMetadataCohort& cohort);
}  // namespace helpers
}  // namespace tpcd::metadata

#endif  // COMPONENTS_TPCD_METADATA_BROWSER_MANAGER_H_