chromium/components/variations/service/variations_field_trial_creator_base.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/variations/service/variations_field_trial_creator_base.h"

#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

#include <cstdint>
#include <memory>
#include <set>
#include <utility>

#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/debug/dump_without_crashing.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/json/json_file_value_serializer.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/process/process.h"
#include "base/strings/pattern.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/system/sys_info.h"
#include "base/trace_event/trace_event.h"
#include "base/version.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/metrics/metrics_state_manager.h"
#include "components/prefs/pref_service.h"
#include "components/variations/entropy_provider.h"
#include "components/variations/field_trial_config/field_trial_util.h"
#include "components/variations/limited_entropy_mode_gate.h"
#include "components/variations/platform_field_trials.h"
#include "components/variations/pref_names.h"
#include "components/variations/proto/variations_seed.pb.h"
#include "components/variations/service/buildflags.h"
#include "components/variations/service/limited_entropy_randomization.h"
#include "components/variations/service/limited_entropy_synthetic_trial.h"
#include "components/variations/service/safe_seed_manager.h"
#include "components/variations/service/variations_service_client.h"
#include "components/variations/service/variations_service_utils.h"
#include "components/variations/synthetic_trial_registry.h"
#include "components/variations/variations_ids_provider.h"
#include "components/variations/variations_layers.h"
#include "components/variations/variations_seed_processor.h"
#include "components/variations/variations_switches.h"
#include "components/version_info/version_info.h"
#include "ui/base/device_form_factor.h"

namespace variations {
namespace {

// Records the loaded seed's expiry status.
void RecordSeedExpiry(bool is_safe_seed, VariationsSeedExpiry seed_expiry) {}

// Records the loaded seed's age.
void RecordSeedFreshness(base::TimeDelta seed_age) {}

// Records details about Chrome's attempt to apply a variations seed.
void RecordVariationsSeedUsage(SeedUsage usage) {}

// If an invalid command-line to force field trials was specified, exit the
// browser with a helpful error message, so that the user can correct their
// mistake.
void ExitWithMessage(const std::string& message) {}

// Retrieves the value of the policy converted to the RestrictionPolicyValues.
RestrictionPolicy GetVariationPolicyRestriction(PrefService* local_state) {}

Study::CpuArchitecture GetCurrentCpuArchitecture() {}

#if BUILDFLAG(FIELDTRIAL_TESTING_ENABLED)
// Determines whether the field trial testing config defined in
// testing/variations/fieldtrial_testing_config.json should be applied. If the
// "disable_fieldtrial_testing_config" GN flag is set to true, then the testing
// config should never be applied. Otherwise, if the build is a Chrome-branded
// build, then the testing config should only be applied if either the
// "--enable-field-trial-config" or
// "--enable-benchmarking=enable-field-trial-config" switch is passed. For
// non-Chrome branded builds, by default, the testing config is applied, unless
// the "--disable-field-trial-config" and/or "--variations-server-url" switches
// are passed and no enabling switches are set.
bool ShouldUseFieldTrialTestingConfig(const base::CommandLine* command_line) {}
#endif  // BUILDFLAG(FIELDTRIAL_TESTING_ENABLED)

// Causes Chrome to start watching for browser crashes if the following
// conditions are met:
// 1. This is not a background session.
// 2. Extended Variations Safe Mode is supported on this platform.
void MaybeExtendVariationsSafeMode(
    metrics::MetricsStateManager* metrics_state_manager) {}

// Returns true iff the given seed contains a layer with LIMITED entropy mode.
bool ContainsLimitedEntropyLayer(const VariationsSeed& seed) {}

}  // namespace

BASE_FEATURE();

Study::Channel ConvertProductChannelToStudyChannel(
    version_info::Channel product_channel) {}

VariationsFieldTrialCreatorBase::VariationsFieldTrialCreatorBase(
    VariationsServiceClient* client,
    std::unique_ptr<VariationsSeedStore> seed_store,
    base::OnceCallback<std::string(PrefService*)> locale_cb,
    LimitedEntropySyntheticTrial* limited_entropy_synthetic_trial)
    :{}

VariationsFieldTrialCreatorBase::~VariationsFieldTrialCreatorBase() = default;

std::string VariationsFieldTrialCreatorBase::GetLatestCountry() const {}

bool VariationsFieldTrialCreatorBase::SetUpFieldTrials(
    const std::vector<std::string>& variation_ids,
    const std::string& command_line_variation_ids,
    const std::vector<base::FeatureList::FeatureOverrideInfo>& extra_overrides,
    std::unique_ptr<base::FeatureList> feature_list,
    metrics::MetricsStateManager* metrics_state_manager,
    SyntheticTrialRegistry* synthetic_trial_registry,
    PlatformFieldTrials* platform_field_trials,
    SafeSeedManagerBase* safe_seed_manager,
    bool add_entropy_source_to_variations_ids) {}

std::unique_ptr<ClientFilterableState>
VariationsFieldTrialCreatorBase::GetClientFilterableStateForVersion(
    const base::Version& version) {}

std::string VariationsFieldTrialCreatorBase::LoadPermanentConsistencyCountry(
    const base::Version& version,
    const std::string& latest_country) {}

void VariationsFieldTrialCreatorBase::StorePermanentCountry(
    const base::Version& version,
    const std::string& country) {}

void VariationsFieldTrialCreatorBase::StoreVariationsOverriddenCountry(
    const std::string& country) {}

void VariationsFieldTrialCreatorBase::OverrideVariationsPlatform(
    Study::Platform platform_override) {}

Study::Platform VariationsFieldTrialCreatorBase::GetPlatform() {}

Study::FormFactor VariationsFieldTrialCreatorBase::GetCurrentFormFactor() {}

#if BUILDFLAG(FIELDTRIAL_TESTING_ENABLED)
void VariationsFieldTrialCreatorBase::ApplyFieldTrialTestingConfig(
    base::FeatureList* feature_list) {}
#endif  // BUILDFLAG(FIELDTRIAL_TESTING_ENABLED)

base::Time VariationsFieldTrialCreatorBase::CalculateSeedFreshness() {}

bool VariationsFieldTrialCreatorBase::HasSeedExpired() {}

bool VariationsFieldTrialCreatorBase::IsSeedForFutureMilestone(
    bool is_safe_seed) {}

base::flat_set<uint64_t>
VariationsFieldTrialCreatorBase::GetGoogleGroupsFromPrefs() {}

bool VariationsFieldTrialCreatorBase::
    ShouldActivateLimitedEntropySyntheticTrial(const VariationsSeed& seed) {}

void VariationsFieldTrialCreatorBase::
    RegisterLimitedEntropySyntheticTrialIfNeeded(
        const VariationsSeed& seed,
        SyntheticTrialRegistry* synthetic_trial_registry) {}

bool VariationsFieldTrialCreatorBase::CreateTrialsFromSeed(
    const EntropyProviders& entropy_providers,
    base::FeatureList* feature_list,
    SafeSeedManagerBase* safe_seed_manager,
    SyntheticTrialRegistry* synthetic_trial_registry) {}

void VariationsFieldTrialCreatorBase::LoadSeedFromJsonFile(
    const base::FilePath& json_seed_path) {}

VariationsSeedStore* VariationsFieldTrialCreatorBase::GetSeedStore() {}

// static
bool VariationsFieldTrialCreatorBase::
    IsLimitedEntropyRandomizationSourceEnabled(
        version_info::Channel channel,
        LimitedEntropySyntheticTrial* trial) {}

}  // namespace variations