Chromium Code Reviews| Index: components/variations/variations_associated_data.cc |
| diff --git a/components/variations/variations_associated_data.cc b/components/variations/variations_associated_data.cc |
| index d7dda4b97d188a4c208e11ab5f35ba86551cdb94..33c49a9b9bd5ec5d7ad5378e9d031c237cf07b6c 100644 |
| --- a/components/variations/variations_associated_data.cc |
| +++ b/components/variations/variations_associated_data.cc |
| @@ -11,6 +11,8 @@ |
| #include "base/feature_list.h" |
| #include "base/macros.h" |
| #include "base/memory/singleton.h" |
| +#include "base/strings/string_split.h" |
| +#include "components/variations/variations_http_header_provider.h" |
| namespace variations { |
| @@ -166,6 +168,31 @@ class VariationsParamAssociator { |
| } // namespace |
| +VariationsHttpHeaderProvider* ForceVariationIDsForHttpHeaders( |
| + std::vector<std::string> variation_ids, |
| + std::string command_line_variation_ids) { |
|
Alexei Svitkine (slow)
2016/07/26 16:43:35
Pass the string by const& and the |variations_ids|
jkrcal
2016/07/27 10:09:03
Huh, a silly mistake. Done.
|
| + if (!variation_ids.empty()) { |
| + // Combine the variation ids from chrome://flags with the ones from the |
|
Alexei Svitkine (slow)
2016/07/26 16:43:35
Seems strange to mention chrome://flags here, sinc
jkrcal
2016/07/27 10:09:04
Done. (Actually, had a bug there, wanted to check
|
| + // command-line flag. |
| + std::vector<std::string> variation_ids_flags = |
| + base::SplitString(command_line_variation_ids, ",", |
| + base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| + variation_ids.insert(variation_ids.end(), variation_ids_flags.begin(), |
| + variation_ids_flags.end()); |
| + } |
| + |
| + if (!variation_ids.empty()) { |
| + // Create default variation ids which will always be included in the |
| + // X-Client-Data request header. |
| + VariationsHttpHeaderProvider* provider = |
| + VariationsHttpHeaderProvider::GetInstance(); |
| + CHECK(provider->SetDefaultVariationIds(variation_ids)) |
| + << "Invalid list of variation ids specified"; |
| + return provider; |
| + } |
| + return nullptr; |
|
Alexei Svitkine (slow)
2016/07/26 16:43:35
Seems like the previous code actually had a bug, s
jkrcal
2016/07/27 10:09:04
Done.
|
| +} |
| + |
| void AssociateGoogleVariationID(IDCollectionKey key, |
| const std::string& trial_name, |
| const std::string& group_name, |