| Index: components/variations/variations_associated_data.cc
|
| diff --git a/components/variations/variations_associated_data.cc b/components/variations/variations_associated_data.cc
|
| index 9a84a32fe64637789f227c36677e3ea92e7210eb..9aa51d379f3d884a094d208d621e0d4eaacbe7f8 100644
|
| --- a/components/variations/variations_associated_data.cc
|
| +++ b/components/variations/variations_associated_data.cc
|
| @@ -8,6 +8,7 @@
|
| #include <utility>
|
| #include <vector>
|
|
|
| +#include "base/feature_list.h"
|
| #include "base/macros.h"
|
| #include "base/memory/singleton.h"
|
|
|
| @@ -212,6 +213,18 @@ bool GetVariationParams(const std::string& trial_name,
|
| trial_name, params);
|
| }
|
|
|
| +bool GetVariationParamsByFeature(const base::Feature& feature,
|
| + std::map<std::string, std::string>* params) {
|
| + if (!base::FeatureList::IsEnabled(feature))
|
| + return false;
|
| +
|
| + base::FieldTrial* trial = base::FeatureList::GetFieldTrial(feature);
|
| + if (!trial)
|
| + return false;
|
| +
|
| + return GetVariationParams(trial->trial_name(), params);
|
| +}
|
| +
|
| std::string GetVariationParamValue(const std::string& trial_name,
|
| const std::string& param_name) {
|
| std::map<std::string, std::string> params;
|
| @@ -223,6 +236,18 @@ std::string GetVariationParamValue(const std::string& trial_name,
|
| return std::string();
|
| }
|
|
|
| +std::string GetVariationParamValueByFeature(const base::Feature& feature,
|
| + const std::string& param_name) {
|
| + if (!base::FeatureList::IsEnabled(feature))
|
| + return std::string();
|
| +
|
| + base::FieldTrial* trial = base::FeatureList::GetFieldTrial(feature);
|
| + if (!trial)
|
| + return std::string();
|
| +
|
| + return GetVariationParamValue(trial->trial_name(), param_name);
|
| +}
|
| +
|
| // Functions below are exposed for testing explicitly behind this namespace.
|
| // They simply wrap existing functions in this file.
|
| namespace testing {
|
|
|