| Index: chrome/browser/autocomplete/autocomplete_field_trial.cc
|
| diff --git a/chrome/browser/autocomplete/autocomplete_field_trial.cc b/chrome/browser/autocomplete/autocomplete_field_trial.cc
|
| index 412936e77793066d4798d957b025974020113f7c..08e5410129479853e04e27d4825e3c719939a836 100644
|
| --- a/chrome/browser/autocomplete/autocomplete_field_trial.cc
|
| +++ b/chrome/browser/autocomplete/autocomplete_field_trial.cc
|
| @@ -32,6 +32,8 @@ static const char kHQPReplaceHUPScoringFieldTrialName[] =
|
| "OmniboxHQPReplaceHUPHostFix";
|
| static const char kHQPOnlyCountMatchesAtWordBoundariesFieldTrialName[] =
|
| "OmniboxHQPOnlyCountMatchesAtWordBoundaries";
|
| +static const char kHQPUseCursorPositionFieldTrialName[] =
|
| + "OmniboxHQPUseCursorPosition";
|
|
|
| // The autocomplete dynamic field trial name prefix. Each field trial is
|
| // configured dynamically and is retrieved automatically by Chrome during
|
| @@ -93,6 +95,13 @@ const base::FieldTrial::Probability
|
| const base::FieldTrial::Probability
|
| kHQPOnlyCountMatchesAtWordBoundariesFieldTrialExperimentFraction = 0;
|
|
|
| +// For the field trial that allows HistoryQuick provider to use the
|
| +// cursor position, put 25% ( = 25/100 ) of the users in the experiment group.
|
| +const base::FieldTrial::Probability
|
| + kHQPUseCursorPositionFieldTrialDivisor = 100;
|
| +const base::FieldTrial::Probability
|
| + kHQPUseCursorPositionFieldTrialExperimentFraction = 25;
|
| +
|
|
|
| // Field trial IDs.
|
| // Though they are not literally "const", they are set only once, in
|
| @@ -124,6 +133,10 @@ int hqp_replace_hup_scoring_experiment_group = 0;
|
| // word boundaries experiment group.
|
| int hqp_only_count_matches_at_word_boundaries_experiment_group = 0;
|
|
|
| +// Field trial ID for the HistoryQuick provider use cursor position
|
| +// experiment group.
|
| +int hqp_use_cursor_position_experiment_group = 0;
|
| +
|
| }
|
|
|
|
|
| @@ -233,6 +246,17 @@ void AutocompleteFieldTrial::ActivateStaticTrials() {
|
| trial->AppendGroup("HQPOnlyCountMatchesAtWordBoundaries",
|
| kHQPOnlyCountMatchesAtWordBoundariesFieldTrialExperimentFraction);
|
|
|
| + // Create the field trial that allows HistoryQuick provider to break
|
| + // omnibox inputs at the cursor position. Make it expire on August 23, 2013.
|
| + trial = base::FieldTrialList::FactoryGetFieldTrial(
|
| + kHQPUseCursorPositionFieldTrialName,
|
| + kHQPUseCursorPositionFieldTrialDivisor,
|
| + "Standard", 2013, 8, 23, NULL);
|
| + trial->UseOneTimeRandomization();
|
| + hqp_use_cursor_position_experiment_group =
|
| + trial->AppendGroup("HQPUseCursorPosition",
|
| + kHQPUseCursorPositionFieldTrialExperimentFraction);
|
| +
|
| static_field_trials_initialized = true;
|
| }
|
|
|
| @@ -340,3 +364,18 @@ bool AutocompleteFieldTrial::
|
| kHQPOnlyCountMatchesAtWordBoundariesFieldTrialName);
|
| return group == hqp_only_count_matches_at_word_boundaries_experiment_group;
|
| }
|
| +
|
| +bool AutocompleteFieldTrial::InHQPUseCursorPositionFieldTrial() {
|
| + return base::FieldTrialList::TrialExists(kHQPUseCursorPositionFieldTrialName);
|
| +}
|
| +
|
| +bool AutocompleteFieldTrial::
|
| + InHQPUseCursorPositionFieldTrialExperimentGroup() {
|
| + if (!InHQPUseCursorPositionFieldTrial())
|
| + return false;
|
| +
|
| + // Return true if we're in the experiment group.
|
| + const int group = base::FieldTrialList::FindValue(
|
| + kHQPUseCursorPositionFieldTrialName);
|
| + return group == hqp_use_cursor_position_experiment_group;
|
| +}
|
|
|