#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 {
void RecordSeedExpiry(bool is_safe_seed, VariationsSeedExpiry seed_expiry) { … }
void RecordSeedFreshness(base::TimeDelta seed_age) { … }
void RecordVariationsSeedUsage(SeedUsage usage) { … }
void ExitWithMessage(const std::string& message) { … }
RestrictionPolicy GetVariationPolicyRestriction(PrefService* local_state) { … }
Study::CpuArchitecture GetCurrentCpuArchitecture() { … }
#if BUILDFLAG(FIELDTRIAL_TESTING_ENABLED)
bool ShouldUseFieldTrialTestingConfig(const base::CommandLine* command_line) { … }
#endif
void MaybeExtendVariationsSafeMode(
metrics::MetricsStateManager* metrics_state_manager) { … }
bool ContainsLimitedEntropyLayer(const VariationsSeed& seed) { … }
}
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
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() { … }
bool VariationsFieldTrialCreatorBase::
IsLimitedEntropyRandomizationSourceEnabled(
version_info::Channel channel,
LimitedEntropySyntheticTrial* trial) { … }
}