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

Unified Diff: components/variations/variations_associated_data.h

Issue 1941963002: Add variations params api to get params from features. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « base/feature_list_unittest.cc ('k') | components/variations/variations_associated_data.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/variations/variations_associated_data.h
diff --git a/components/variations/variations_associated_data.h b/components/variations/variations_associated_data.h
index 79f31a31e0516904de7f7a262a785d8742cdefdd..3eb9567cc3afe41848602b2fc9a2eabdaa00de77 100644
--- a/components/variations/variations_associated_data.h
+++ b/components/variations/variations_associated_data.h
@@ -41,6 +41,10 @@
// // use |id|
// }
+namespace base {
+struct Feature;
+}
+
namespace variations {
typedef int VariationID;
@@ -123,6 +127,18 @@ bool AssociateVariationParams(const std::string& trial_name,
bool GetVariationParams(const std::string& trial_name,
std::map<std::string, std::string>* params);
+// Retrieves the set of key-value |params| for the variation associated with the
+// specified |feature|. A feature is associated with at most one variation,
+// through the variation's associated field trial, and selected group. See
+// base/feature_list.h for more information on features. If the feature is not
+// enabled, or if there's no associated variation params, returns false and does
+// not modify |params|. Calling this function will result in the associated
+// field trial being marked as active if found (i.e. group() will be called on
+// it), if it wasn't already. Currently, this information is only available from
+// the browser process. Thread safe.
+bool GetVariationParamsByFeature(const base::Feature& feature,
+ std::map<std::string, std::string>* params);
+
// Retrieves a specific parameter value corresponding to |param_name| for the
// variation associated with the specified field trial, based on its selected
// group. If the field trial does not exist or the specified parameter does not
@@ -133,6 +149,18 @@ bool GetVariationParams(const std::string& trial_name,
std::string GetVariationParamValue(const std::string& trial_name,
const std::string& param_name);
+// Retrieves a specific parameter value corresponding to |param_name| for the
+// variation associated with the specified |feature|. A feature is associated
+// with at most one variation, through the variation's associated field trial,
+// and selected group. See base/feature_list.h for more information on
+// features. If the feature is not enabled, or if there's no associated
+// variation params, returns false and does not modify |params|. Calling this
+// function will result in the associated field trial being marked as active if
+// found (i.e. group() will be called on it), if it wasn't already. Currently,
+// this information is only available from the browser process. Thread safe.
+std::string GetVariationParamValueByFeature(const base::Feature& feature,
+ const std::string& param_name);
+
// Expose some functions for testing.
namespace testing {
« no previous file with comments | « base/feature_list_unittest.cc ('k') | components/variations/variations_associated_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698