Index: base/metrics/field_trial.cc |
diff --git a/base/metrics/field_trial.cc b/base/metrics/field_trial.cc |
index f718ab0371fa3b05cc6be4e0a0ab254e820c1e71..712f27c5b78be6e65cbece880e05879636db4fb0 100644 |
--- a/base/metrics/field_trial.cc |
+++ b/base/metrics/field_trial.cc |
@@ -399,8 +399,10 @@ void FieldTrialList::GetActiveFieldTrialGroups( |
} |
// static |
-bool FieldTrialList::CreateTrialsFromString(const std::string& trials_string, |
- FieldTrialActivationMode mode) { |
+bool FieldTrialList::CreateTrialsFromString( |
+ const std::string& trials_string, |
+ FieldTrialActivationMode mode, |
+ const IsAcceptedFieldTrialCallback& is_accepted_callback) { |
DCHECK(global_); |
if (trials_string.empty() || !global_) |
return true; |
@@ -419,14 +421,16 @@ bool FieldTrialList::CreateTrialsFromString(const std::string& trials_string, |
group_name_end - name_end - 1); |
next_item = group_name_end + 1; |
- FieldTrial* trial = CreateFieldTrial(name, group_name); |
- if (!trial) |
- return false; |
- if (mode == ACTIVATE_TRIALS) { |
- // Call |group()| to mark the trial as "used" and notify observers, if |
- // any. This is useful to ensure that field trials created in child |
- // processes are properly reported in crash reports. |
- trial->group(); |
+ if (is_accepted_callback.is_null() || is_accepted_callback.Run(name)) { |
+ FieldTrial* trial = CreateFieldTrial(name, group_name); |
+ if (!trial) |
+ return false; |
+ if (mode == ACTIVATE_TRIALS) { |
+ // Call |group()| to mark the trial as "used" and notify observers, if |
+ // any. This is useful to ensure that field trials created in child |
+ // processes are properly reported in crash reports. |
+ trial->group(); |
+ } |
} |
} |
return true; |