chromium/chrome/browser/privacy_budget/identifiability_study_state.cc

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

#include "chrome/browser/privacy_budget/identifiability_study_state.h"

#include <algorithm>
#include <cstddef>
#include <limits>
#include <random>
#include <set>
#include <type_traits>
#include <utility>
#include <vector>

#include "base/check.h"
#include "base/check_op.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/containers/contains.h"
#include "base/containers/flat_tree.h"
#include "base/dcheck_is_on.h"
#include "base/metrics/field_trial_params.h"
#include "base/rand_util.h"
#include "base/ranges/algorithm.h"
#include "base/version_info/channel.h"
#include "chrome/browser/privacy_budget/identifiability_study_group_settings.h"
#include "chrome/browser/privacy_budget/privacy_budget_prefs.h"
#include "chrome/browser/privacy_budget/representative_surface_set.h"
#include "chrome/browser/privacy_budget/surface_set_equivalence.h"
#include "chrome/common/channel_info.h"
#include "chrome/common/privacy_budget/field_trial_param_conversions.h"
#include "chrome/common/privacy_budget/identifiability_study_configurator.mojom.h"
#include "chrome/common/privacy_budget/privacy_budget_features.h"
#include "chrome/common/privacy_budget/privacy_budget_settings_provider.h"
#include "chrome/common/privacy_budget/types.h"
#include "components/prefs/pref_service.h"
#include "components/variations/variations_switches.h"
#include "content/public/browser/render_process_host.h"
#include "ipc/ipc_channel_proxy.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "third_party/blink/public/common/privacy_budget/identifiability_study_settings.h"
#include "third_party/blink/public/common/privacy_budget/identifiability_study_settings_provider.h"
#include "third_party/blink/public/common/privacy_budget/identifiable_surface.h"

namespace {

int GetStudyGenerationFromFieldTrial() {}

double GetMetaExperimentActivationProbability() {}

}  // namespace

constexpr int IdentifiabilityStudyState::kGeneratorVersion;

IdentifiabilityStudyState::IdentifiabilityStudyState(PrefService* pref_service)
    :{}

IdentifiabilityStudyState::~IdentifiabilityStudyState() = default;

int IdentifiabilityStudyState::generation() const {}

bool IdentifiabilityStudyState::ShouldRecordSurface(
    blink::IdentifiableSurface surface) {}

// static
void IdentifiabilityStudyState::ResetGlobalStudySettingsForTesting() {}

void IdentifiabilityStudyState::InitializeGlobalStudySettings() {}

void IdentifiabilityStudyState::InitializeRenderer(
    content::RenderProcessHost* render_process_host) {}

bool IdentifiabilityStudyState::DecideInclusionForNewSurface(
    blink::IdentifiableSurface new_surface) {}

unsigned IdentifiabilityStudyState::GetCountOfOffsetsToSelect() const {}

void IdentifiabilityStudyState::MaybeUpdateSelectedOffsets() {}

void IdentifiabilityStudyState::UpdateSelectedOffsets(
    unsigned offsets_to_select) {}

#if EXPENSIVE_DCHECKS_ARE_ON()
namespace {
// Predicate used in CheckInvariants().
bool IsSurfaceAllowed(const blink::IdentifiableSurface& value) {}
bool IsRepresentativeSurfaceAllowed(const RepresentativeSurface& value) {}
}  // namespace

void IdentifiabilityStudyState::CheckInvariants() const {}
#else   // EXPENSIVE_DCHECKS_ARE_ON()
void IdentifiabilityStudyState::CheckInvariants() const {}
#endif  // EXPENSIVE_DCHECKS_ARE_ON()

bool IdentifiabilityStudyState::CanAddOneMoreActiveSurface() const {}

void IdentifiabilityStudyState::ResetPerReportState() {}

void IdentifiabilityStudyState::ResetInMemoryState() {}

void IdentifiabilityStudyState::ResetPersistedState() {}

void IdentifiabilityStudyState::InitStateForAssignedBlockSampling() {}

// static
int IdentifiabilityStudyState::SelectMultinomialChoice(
    const std::vector<double>& weights) {}

// static
bool IdentifiabilityStudyState::IsValidOffset(OffsetType ord) {}

// static
bool IdentifiabilityStudyState::StripDisallowedSurfaces(
    IdentifiableSurfaceList& container,
    std::vector<OffsetType>& dropped_offsets) {}

// static
std::vector<IdentifiabilityStudyState::OffsetType>
IdentifiabilityStudyState::AdjustForDroppedOffsets(
    std::vector<OffsetType> dropped_offsets,
    std::vector<OffsetType> offsets) {}

bool IdentifiabilityStudyState::IsMetaExperimentActive() {}

void IdentifiabilityStudyState::InitFromPrefs() {}

void IdentifiabilityStudyState::InitStateForRandomSurfaceSampling() {}

bool IdentifiabilityStudyState::TryAddNewlySeenSurface(
    blink::IdentifiableSurface surface) {}

void IdentifiabilityStudyState::WriteSeenSurfacesToPrefs() const {}

void IdentifiabilityStudyState::WriteSelectedOffsetsToPrefs() const {}

bool IdentifiabilityStudyState::ShouldReportEncounteredSurface(
    uint64_t source_id,
    blink::IdentifiableSurface surface) {}