Chromium Code Reviews| 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)); |