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

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: Alexei's and Lei's comments 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
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | components/flags_ui/feature_entry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a6079bc819bc71c2fb836e6847edcbddad24d901 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -730,26 +730,36 @@ 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::vector<std::string> variation_ids =
+ about_flags::RegisterAllFeatureVariationParameters(
+ &flags_storage, feature_list.get());
+
if (command_line->HasSwitch(switches::kForceVariationIds)) {
+ // Combine the variation ids from chrome://flags with the ones from the
+ // command-line flag.
+ std::vector<std::string> variation_ids_flags = base::SplitString(
+ command_line->GetSwitchValueASCII(switches::kForceVariationIds), ",",
+ base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
+ variation_ids.insert(variation_ids.end(), variation_ids_flags.begin(),
+ variation_ids_flags.end());
+ }
Alexei Svitkine (slow) 2016/07/26 14:44:07 I still think all this work should be being done i
jkrcal 2016/07/26 15:50:39 Done. It was not super clear to me where to cut th
+
+ 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));
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | components/flags_ui/feature_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698