| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/omnibox/omnibox_field_trial.h" | 5 #include "chrome/browser/omnibox/omnibox_field_trial.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "chrome/common/metrics/metrics_util.h" | 13 #include "chrome/common/metrics/metrics_util.h" |
| 14 #include "chrome/common/metrics/variations/variation_ids.h" | 14 #include "chrome/common/metrics/variations/variation_ids.h" |
| 15 #include "chrome/common/metrics/variations/variations_util.h" | 15 #include "chrome/common/metrics/variations/variations_util.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 // Field trial names. | 19 // Field trial names. |
| 20 const char kDisallowInlineHQPFieldTrialName[] = "OmniboxDisallowInlineHQP"; | 20 const char kDisallowInlineHQPFieldTrialName[] = "OmniboxDisallowInlineHQP"; |
| 21 const char kHQPNewScoringFieldTrialName[] = "OmniboxHQPNewScoringMax1400"; | 21 const char kHQPNewScoringFieldTrialName[] = "OmniboxHQPNewScoringMax1400"; |
| 22 const char kHUPCullRedirectsFieldTrialName[] = "OmniboxHUPCullRedirects"; | 22 const char kHUPCullRedirectsFieldTrialName[] = "OmniboxHUPCullRedirects"; |
| 23 const char kHUPCreateShorterMatchFieldTrialName[] = | 23 const char kHUPCreateShorterMatchFieldTrialName[] = |
| 24 "OmniboxHUPCreateShorterMatch"; | 24 "OmniboxHUPCreateShorterMatch"; |
| 25 const char kHQPReplaceHUPScoringFieldTrialName[] = | 25 const char kHQPReplaceHUPScoringFieldTrialName[] = |
| 26 "OmniboxHQPReplaceHUPProhibitTrumpingInlineableResult"; | 26 "OmniboxHQPReplaceHUPProhibitTrumpingInlineableResult"; |
| 27 const char kStopTimerFieldTrialName[] = "OmniboxStopTimer"; |
| 27 | 28 |
| 28 // The autocomplete dynamic field trial name prefix. Each field trial is | 29 // The autocomplete dynamic field trial name prefix. Each field trial is |
| 29 // configured dynamically and is retrieved automatically by Chrome during | 30 // configured dynamically and is retrieved automatically by Chrome during |
| 30 // the startup. | 31 // the startup. |
| 31 const char kAutocompleteDynamicFieldTrialPrefix[] = "AutocompleteDynamicTrial_"; | 32 const char kAutocompleteDynamicFieldTrialPrefix[] = "AutocompleteDynamicTrial_"; |
| 32 // The maximum number of the autocomplete dynamic field trials (aka layers). | 33 // The maximum number of the autocomplete dynamic field trials (aka layers). |
| 33 const int kMaxAutocompleteDynamicFieldTrials = 5; | 34 const int kMaxAutocompleteDynamicFieldTrials = 5; |
| 34 | 35 |
| 35 // Field trial experiment probabilities. | 36 // Field trial experiment probabilities. |
| 36 | 37 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 66 | 67 |
| 67 // For the field trial that removes searching/scoring URLs from | 68 // For the field trial that removes searching/scoring URLs from |
| 68 // HistoryURL provider and adds a HistoryURL-provider-like scoring | 69 // HistoryURL provider and adds a HistoryURL-provider-like scoring |
| 69 // mode to HistoryQuick provider, put 0% ( = 0/100 ) of the users in | 70 // mode to HistoryQuick provider, put 0% ( = 0/100 ) of the users in |
| 70 // the experiment group. | 71 // the experiment group. |
| 71 const base::FieldTrial::Probability | 72 const base::FieldTrial::Probability |
| 72 kHQPReplaceHUPScoringFieldTrialDivisor = 100; | 73 kHQPReplaceHUPScoringFieldTrialDivisor = 100; |
| 73 const base::FieldTrial::Probability | 74 const base::FieldTrial::Probability |
| 74 kHQPReplaceHUPScoringFieldTrialExperimentFraction = 0; | 75 kHQPReplaceHUPScoringFieldTrialExperimentFraction = 0; |
| 75 | 76 |
| 77 // Experiment group names. |
| 78 |
| 79 const char kStopTimerExperimentGroupName[] = "UseStopTimer"; |
| 76 | 80 |
| 77 // Field trial IDs. | 81 // Field trial IDs. |
| 78 // Though they are not literally "const", they are set only once, in | 82 // Though they are not literally "const", they are set only once, in |
| 79 // ActivateStaticTrials() below. | 83 // ActivateStaticTrials() below. |
| 80 | 84 |
| 81 // Whether the static field trials have been initialized by | 85 // Whether the static field trials have been initialized by |
| 82 // ActivateStaticTrials() method. | 86 // ActivateStaticTrials() method. |
| 83 bool static_field_trials_initialized = false; | 87 bool static_field_trials_initialized = false; |
| 84 | 88 |
| 85 // Field trial ID for the disallow-inline History Quick Provider | 89 // Field trial ID for the disallow-inline History Quick Provider |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 | 285 |
| 282 bool OmniboxFieldTrial::InHQPReplaceHUPScoringFieldTrialExperimentGroup() { | 286 bool OmniboxFieldTrial::InHQPReplaceHUPScoringFieldTrialExperimentGroup() { |
| 283 if (!InHQPReplaceHUPScoringFieldTrial()) | 287 if (!InHQPReplaceHUPScoringFieldTrial()) |
| 284 return false; | 288 return false; |
| 285 | 289 |
| 286 // Return true if we're in the experiment group. | 290 // Return true if we're in the experiment group. |
| 287 const int group = base::FieldTrialList::FindValue( | 291 const int group = base::FieldTrialList::FindValue( |
| 288 kHQPReplaceHUPScoringFieldTrialName); | 292 kHQPReplaceHUPScoringFieldTrialName); |
| 289 return group == hqp_replace_hup_scoring_experiment_group; | 293 return group == hqp_replace_hup_scoring_experiment_group; |
| 290 } | 294 } |
| 295 |
| 296 bool OmniboxFieldTrial::InStopTimerFieldTrialExperimentGroup() { |
| 297 return (base::FieldTrialList::FindFullName(kStopTimerFieldTrialName) == |
| 298 kStopTimerExperimentGroupName); |
| 299 } |
| OLD | NEW |