Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1670)

Unified Diff: components/variations/variations_seed_processor.cc

Issue 1984003002: Use low entropy for studies that send experiment IDs to Google properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/variations/variations_seed_processor.cc
diff --git a/components/variations/variations_seed_processor.cc b/components/variations/variations_seed_processor.cc
index c7690ca5052bde7b5c03b3ed6a78430ab65a25bb..fb4d7e56700188ce290b8ade8c9fcd3c4e8b93c2 100644
--- a/components/variations/variations_seed_processor.cc
+++ b/components/variations/variations_seed_processor.cc
@@ -187,6 +187,7 @@ void VariationsSeedProcessor::CreateTrialsFromSeed(
const std::string& session_consistency_country,
const std::string& permanent_consistency_country,
const UIStringOverrideCallback& override_callback,
+ const base::FieldTrial::EntropyProvider* low_entropy_provider,
base::FeatureList* feature_list) {
std::vector<ProcessedStudy> filtered_studies;
FilterAndValidateStudies(seed, locale, reference_date, version, channel,
@@ -195,12 +196,28 @@ void VariationsSeedProcessor::CreateTrialsFromSeed(
permanent_consistency_country, &filtered_studies);
for (size_t i = 0; i < filtered_studies.size(); ++i)
- CreateTrialFromStudy(filtered_studies[i], override_callback, feature_list);
+ CreateTrialFromStudy(filtered_studies[i], override_callback,
+ low_entropy_provider, feature_list);
+}
+
+// static
+bool VariationsSeedProcessor::ShouldStudyUseLowEntropy(const Study& study) {
+ for (int i = 0; i < study.experiment_size(); ++i) {
+ const Study_Experiment& experiment = study.experiment(i);
+ if (experiment.has_google_web_experiment_id() ||
+ experiment.has_google_web_trigger_experiment_id() ||
+ experiment.has_google_update_experiment_id() ||
+ experiment.has_chrome_sync_experiment_id()) {
+ return true;
+ }
+ }
+ return false;
}
void VariationsSeedProcessor::CreateTrialFromStudy(
const ProcessedStudy& processed_study,
const UIStringOverrideCallback& override_callback,
+ const base::FieldTrial::EntropyProvider* low_entropy_provider,
base::FeatureList* feature_list) {
const Study& study = *processed_study.study();
@@ -255,7 +272,8 @@ void VariationsSeedProcessor::CreateTrialFromStudy(
study.name(), processed_study.total_probability(),
study.default_experiment_name(),
base::FieldTrialList::kNoExpirationYear, 1, 1, randomization_type,
- randomization_seed, NULL));
+ randomization_seed, NULL,
+ ShouldStudyUseLowEntropy(study) ? low_entropy_provider : NULL));
bool has_overrides = false;
bool enables_or_disables_features = false;
« no previous file with comments | « components/variations/variations_seed_processor.h ('k') | components/variations/variations_seed_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698