Commit 47e60f2d authored by rdevlin.cronin's avatar rdevlin.cronin Committed by Commit bot

[Extensions] Fix report abuse field trial crash

Field trials can only be initialized once, so the FactoryGet() method cannot
be called each time to check the value of the trial.

BUG=470278

Review URL: https://codereview.chromium.org/1023673011

Cr-Commit-Position: refs/heads/master@{#322212}
parent fa798728
......@@ -132,17 +132,23 @@ bool ExtensionUninstallDialog::ShouldShowReportAbuseCheckbox() const {
static const char kExperimentName[] = "ExtensionUninstall.ReportAbuse";
static const char kDefaultGroupName[] = "Default";
static const char kShowCheckboxGroup[] = "ShowCheckbox";
// TODO(devlin): Turn on this field trial. See crbug.com/441377.
scoped_refptr<base::FieldTrial> trial(
base::FieldTrialList::FactoryGetFieldTrial(
kExperimentName,
100, // Total probability.
kDefaultGroupName,
2015, 7, 31, // End date.
base::FieldTrial::ONE_TIME_RANDOMIZED,
nullptr));
int experiment_group = trial->AppendGroup(kShowCheckboxGroup, 0);
return base::FieldTrialList::FindValue(kExperimentName) == experiment_group;
// Important: Only initialize the trial once.
if (!base::FieldTrialList::Find(kExperimentName)) {
// TODO(devlin): Turn on this field trial. See crbug.com/441377.
scoped_refptr<base::FieldTrial> trial(
base::FieldTrialList::FactoryGetFieldTrial(
kExperimentName,
100, // Total probability.
kDefaultGroupName,
2015, 7, 31, // End date.
base::FieldTrial::ONE_TIME_RANDOMIZED,
nullptr));
trial->AppendGroup(kShowCheckboxGroup, 0);
}
return base::FieldTrialList::FindFullName(kExperimentName) ==
kShowCheckboxGroup;
}
void ExtensionUninstallDialog::HandleReportAbuse() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment