chromium/components/privacy_sandbox/privacy_sandbox_attestations/privacy_sandbox_attestations.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 "components/privacy_sandbox/privacy_sandbox_attestations/privacy_sandbox_attestations.h"

#include <ios>
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>

#include "base/check.h"
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/no_destructor.h"
#include "base/observer_list.h"
#include "base/strings/string_split.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/time/time.h"
#include "base/timer/elapsed_timer.h"
#include "base/trace_event/memory_usage_estimator.h"
#include "base/types/expected.h"
#include "components/privacy_sandbox/privacy_sandbox_attestations/privacy_sandbox_attestations_histograms.h"
#include "components/privacy_sandbox/privacy_sandbox_attestations/privacy_sandbox_attestations_parser.h"
#include "components/privacy_sandbox/privacy_sandbox_features.h"
#include "components/startup_metric_utils/browser/startup_metric_utils.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/privacy_sandbox_attestations_observer.h"
#include "net/base/schemeful_site.h"
#include "url/gurl.h"

namespace privacy_sandbox {

namespace {

// Global PrivacySandboxAttestations instance for testing.
PrivacySandboxAttestations* g_test_instance =;

// Helper function that checks if enrollment overrides are set from the
// chrome://flags entry.
bool IsOverriddenByFlags(const net::SchemefulSite& site) {}

void RecordParsingStatusHistogram(ParsingStatus status) {}

// Trigger the opening and parsing of the attestations file. Returns the
// parsed `attestations_map_` or the failure status. This function should only
// be invoked with `kEnforcePrivacySandboxAttestations` enabled.
// `installed_file_path` is the path to the attestations list file.
base::expected<PrivacySandboxAttestationsMap, ParsingStatus>
LoadAttestationsInternal(base::FilePath installed_file_path,
                         base::Version version) {}

}  // namespace

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

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

// static
std::unique_ptr<PrivacySandboxAttestations>
PrivacySandboxAttestations::CreateForTesting() {}

PrivacySandboxAttestations::~PrivacySandboxAttestations() = default;

PrivacySandboxSettingsImpl::Status PrivacySandboxAttestations::IsSiteAttested(
    const net::SchemefulSite& site,
    PrivacySandboxAttestationsGatedAPI invoking_api) const {}

PrivacySandboxSettingsImpl::Status
PrivacySandboxAttestations::IsSiteAttestedInternal(
    const net::SchemefulSite& site,
    PrivacySandboxAttestationsGatedAPI invoking_api) const {}

void PrivacySandboxAttestations::LoadAttestations(
    base::Version version,
    base::FilePath installed_file_path,
    bool is_pre_installed) {}

void PrivacySandboxAttestations::AddOverride(const net::SchemefulSite& site) {}

bool PrivacySandboxAttestations::IsOverridden(
    const net::SchemefulSite& site) const {}

void PrivacySandboxAttestations::SetAllPrivacySandboxAttestedForTesting(
    bool all_attested) {}

void PrivacySandboxAttestations::SetAttestationsForTesting(
    std::optional<PrivacySandboxAttestationsMap> attestations_map) {}

base::Version PrivacySandboxAttestations::GetVersionForTesting() const {}

void PrivacySandboxAttestations::SetLoadAttestationsDoneCallbackForTesting(
    base::OnceClosure callback) {}

void PrivacySandboxAttestations::
    SetLoadAttestationsParsingStartedCallbackForTesting(
        base::OnceClosure callback) {}

void PrivacySandboxAttestations::SetComponentRegistrationCallbackForTesting(
    base::OnceClosure callback) {}

PrivacySandboxAttestations::PrivacySandboxAttestations()
    :{}

void PrivacySandboxAttestations::RunLoadAttestationsDoneCallbackForTesting() {}

bool PrivacySandboxAttestations::
    RunLoadAttestationsParsingStartedCallbackForTesting() {}

void PrivacySandboxAttestations::RunComponentRegistrationCallbackForTesting() {}

void PrivacySandboxAttestations::OnAttestationsParsed(
    base::Version version,
    bool is_pre_installed,
    base::expected<PrivacySandboxAttestationsMap, ParsingStatus>
        attestations_map) {}

void PrivacySandboxAttestations::NotifyObserversOnAttestationsLoaded() {}

bool PrivacySandboxAttestations::AddObserver(
    content::PrivacySandboxAttestationsObserver* observer) {}

void PrivacySandboxAttestations::RemoveObserver(
    content::PrivacySandboxAttestationsObserver* observer) {}

bool PrivacySandboxAttestations::IsEverLoaded() const {}

void PrivacySandboxAttestations::OnAttestationsFileCheckComplete() {}

}  // namespace privacy_sandbox