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

Unified Diff: chrome/browser/chrome_browser_main.cc

Issue 2182553002: Add other variations (with ids) for NTPSnippets to chrome://flags (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove an empty line (added by mistake) Created 4 years, 5 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: chrome/browser/chrome_browser_main.cc
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index 1166a7f31c04fbf2c8ea7305a92023145c11118f..51e8463e0fa7b22ec164b80c8b92faec628c5558 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -730,26 +730,38 @@ void ChromeBrowserMainParts::SetupMetricsAndFieldTrials() {
<< " list specified.";
}
+ std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
+
+ // Associate parameters chosen in about:flags and create trial/group for them.
+ flags_ui::PrefServiceFlagsStorage flags_storage(
+ g_browser_process->local_state());
+ std::string variation_ids =
+ about_flags::RegisterAllFeatureVariationParameters(
+ &flags_storage, feature_list.get());
+
if (command_line->HasSwitch(switches::kForceVariationIds)) {
Lei Zhang 2016/07/25 17:37:20 The command line can have the switch but its value
jkrcal 2016/07/26 09:00:21 Thanks for pointing out! Such a case in handled (a
+ // Combine the variation ids from chrome://flags with the once from the
+ // command-line flag.
+ if (!variation_ids.empty()) {
+ variation_ids +=
+ "," + command_line->GetSwitchValueASCII(switches::kForceVariationIds);
+ } else {
+ variation_ids =
+ command_line->GetSwitchValueASCII(switches::kForceVariationIds);
+ }
+ }
Alexei Svitkine (slow) 2016/07/25 19:15:50 Instead of all this extra work in chrome_browser_m
jkrcal 2016/07/26 09:00:21 I tried to simplify it. Do not like the idea of mo
+
+ if (!variation_ids.empty()) {
// Create default variation ids which will always be included in the
// X-Client-Data request header.
variations::VariationsHttpHeaderProvider* provider =
variations::VariationsHttpHeaderProvider::GetInstance();
- bool result = provider->SetDefaultVariationIds(
- command_line->GetSwitchValueASCII(switches::kForceVariationIds));
- CHECK(result) << "Invalid --" << switches::kForceVariationIds
- << " list specified.";
+ bool result = provider->SetDefaultVariationIds(variation_ids);
+ CHECK(result) << "Invalid list of variation ids specified (either in --"
+ << switches::kForceVariationIds << " or in chrome://flags)";
metrics->AddSyntheticTrialObserver(provider);
}
- std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
-
- // Associate parameters chosen in about:flags and create trial/group for them.
- flags_ui::PrefServiceFlagsStorage flags_storage(
- g_browser_process->local_state());
- about_flags::RegisterAllFeatureVariationParameters(&flags_storage,
- feature_list.get());
-
feature_list->InitializeFromCommandLine(
command_line->GetSwitchValueASCII(switches::kEnableFeatures),
command_line->GetSwitchValueASCII(switches::kDisableFeatures));

Powered by Google App Engine
This is Rietveld 408576698