chromium/content/browser/first_party_sets/first_party_sets_handler_impl_instance.cc

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

#include "content/browser/first_party_sets/first_party_sets_handler_impl_instance.h"

#include <memory>
#include <optional>
#include <string>
#include <vector>

#include "base/files/file.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/sequence_checker.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/types/expected.h"
#include "base/types/optional_util.h"
#include "base/values.h"
#include "content/browser/first_party_sets/first_party_set_parser.h"
#include "content/browser/first_party_sets/first_party_sets_handler_impl.h"
#include "content/browser/first_party_sets/first_party_sets_loader.h"
#include "content/browser/first_party_sets/first_party_sets_overrides_policy.h"
#include "content/browser/first_party_sets/first_party_sets_site_data_remover.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/first_party_sets_handler.h"
#include "content/public/common/content_client.h"
#include "net/base/features.h"
#include "net/first_party_sets/first_party_set_metadata.h"
#include "net/first_party_sets/first_party_sets_context_config.h"
#include "net/first_party_sets/global_first_party_sets.h"
#include "net/first_party_sets/local_set_declaration.h"
#include "net/first_party_sets/sets_mutation.h"

namespace net {
class SchemefulSite;
}  // namespace net

namespace content {

namespace {

constexpr base::FilePath::CharType kFirstPartySetsDatabase[] =);

// Global FirstPartySetsHandler instance for testing. This should be preferred
// by tests when possible.
FirstPartySetsHandler* g_test_instance =;

// Global FirstPartySetsHandlerImpl instance for testing. This is mainly useful
// for tests that need to know about content-internal details.
FirstPartySetsHandlerImpl* g_impl_test_instance =;

base::TaskPriority GetTaskPriority() {}

void RecordSitesToClearCount(int count) {}

}  // namespace

// static
void FirstPartySetsHandler::SetInstanceForTesting(
    FirstPartySetsHandler* test_instance) {}

// static
void FirstPartySetsHandlerImpl::SetInstanceForTesting(
    FirstPartySetsHandlerImpl* test_instance) {}

// static
FirstPartySetsHandler* FirstPartySetsHandler::GetInstance() {}

// static
FirstPartySetsHandlerImpl* FirstPartySetsHandlerImpl::GetInstance() {}

// static
std::pair<base::expected<void, FirstPartySetsHandler::ParseError>,
          std::vector<FirstPartySetsHandler::ParseWarning>>
FirstPartySetsHandler::ValidateEnterprisePolicy(
    const base::Value::Dict& policy) {}

// static
FirstPartySetsHandlerImplInstance
FirstPartySetsHandlerImplInstance::CreateForTesting(
    bool enabled,
    bool embedder_will_provide_public_sets) {}

void FirstPartySetsHandlerImplInstance::GetContextConfigForPolicy(
    const base::Value::Dict* policy,
    base::OnceCallback<void(net::FirstPartySetsContextConfig)> callback) {}

FirstPartySetsHandlerImplInstance::FirstPartySetsHandlerImplInstance(
    bool enabled,
    bool embedder_will_provide_public_sets)
    :{}

FirstPartySetsHandlerImplInstance::~FirstPartySetsHandlerImplInstance() =
    default;

std::optional<net::GlobalFirstPartySets>
FirstPartySetsHandlerImplInstance::GetSets(
    base::OnceCallback<void(net::GlobalFirstPartySets)> callback) {}

void FirstPartySetsHandlerImplInstance::Init(
    const base::FilePath& user_data_dir,
    const net::LocalSetDeclaration& local_set) {}

bool FirstPartySetsHandlerImplInstance::IsEnabled() const {}

void FirstPartySetsHandlerImplInstance::SetPublicFirstPartySets(
    const base::Version& version,
    base::File sets_file) {}

void FirstPartySetsHandlerImplInstance::GetPersistedSetsForTesting(
    const std::string& browser_context_id,
    base::OnceCallback<void(
        std::optional<std::pair<net::GlobalFirstPartySets,
                                net::FirstPartySetsContextConfig>>)> callback) {}

void FirstPartySetsHandlerImplInstance::HasBrowserContextClearedForTesting(
    const std::string& browser_context_id,
    base::OnceCallback<void(std::optional<bool>)> callback) {}

void FirstPartySetsHandlerImplInstance::SetCompleteSets(
    net::GlobalFirstPartySets sets) {}

void FirstPartySetsHandlerImplInstance::SetDatabase(
    const base::FilePath& user_data_dir) {}

void FirstPartySetsHandlerImplInstance::EnqueuePendingTask(
    base::OnceClosure run_task) {}

void FirstPartySetsHandlerImplInstance::InvokePendingQueries() {}

std::optional<net::FirstPartySetEntry>
FirstPartySetsHandlerImplInstance::FindEntry(
    const net::SchemefulSite& site,
    const net::FirstPartySetsContextConfig& config) const {}

net::GlobalFirstPartySets FirstPartySetsHandlerImplInstance::GetGlobalSetsSync()
    const {}

void FirstPartySetsHandlerImplInstance::ClearSiteDataOnChangedSetsForContext(
    base::RepeatingCallback<BrowserContext*()> browser_context_getter,
    const std::string& browser_context_id,
    net::FirstPartySetsContextConfig context_config,
    base::OnceCallback<void(net::FirstPartySetsContextConfig,
                            net::FirstPartySetsCacheFilter)> callback) {}

void FirstPartySetsHandlerImplInstance::
    ClearSiteDataOnChangedSetsForContextInternal(
        base::RepeatingCallback<BrowserContext*()> browser_context_getter,
        const std::string& browser_context_id,
        net::FirstPartySetsContextConfig context_config,
        base::OnceCallback<void(net::FirstPartySetsContextConfig,
                                net::FirstPartySetsCacheFilter)> callback) {}

void FirstPartySetsHandlerImplInstance::OnGetSitesToClear(
    base::RepeatingCallback<BrowserContext*()> browser_context_getter,
    const std::string& browser_context_id,
    net::FirstPartySetsContextConfig context_config,
    base::OnceCallback<void(net::FirstPartySetsContextConfig,
                            net::FirstPartySetsCacheFilter)> callback,
    std::optional<std::pair<std::vector<net::SchemefulSite>,
                            net::FirstPartySetsCacheFilter>> sites_to_clear)
    const {}

void FirstPartySetsHandlerImplInstance::DidClearSiteDataOnChangedSetsForContext(
    const std::string& browser_context_id,
    net::FirstPartySetsContextConfig context_config,
    net::FirstPartySetsCacheFilter cache_filter,
    base::OnceCallback<void(net::FirstPartySetsContextConfig,
                            net::FirstPartySetsCacheFilter)> callback,
    uint64_t failed_data_types) const {}

void FirstPartySetsHandlerImplInstance::ComputeFirstPartySetMetadata(
    const net::SchemefulSite& site,
    const net::SchemefulSite* top_frame_site,
    const net::FirstPartySetsContextConfig& config,
    base::OnceCallback<void(net::FirstPartySetMetadata)> callback) {}

void FirstPartySetsHandlerImplInstance::ComputeFirstPartySetMetadataInternal(
    const net::SchemefulSite& site,
    const std::optional<net::SchemefulSite>& top_frame_site,
    const net::FirstPartySetsContextConfig& config,
    const base::ElapsedTimer& timer,
    base::OnceCallback<void(net::FirstPartySetMetadata)> callback) const {}

net::FirstPartySetsContextConfig
FirstPartySetsHandlerImplInstance::GetContextConfigForPolicyInternal(
    const base::Value::Dict& policy,
    const std::optional<base::ElapsedTimer>& timer) const {}

bool FirstPartySetsHandlerImplInstance::ForEachEffectiveSetEntry(
    const net::FirstPartySetsContextConfig& config,
    base::FunctionRef<bool(const net::SchemefulSite&,
                           const net::FirstPartySetEntry&)> f) const {}

}  // namespace content