Chromium Code Reviews| Index: chrome/browser/omnibox/omnibox_field_trial.cc |
| diff --git a/chrome/browser/omnibox/omnibox_field_trial.cc b/chrome/browser/omnibox/omnibox_field_trial.cc |
| index 2bec78bc0ccf477943baf275e0d459b0f0edaa24..85a66f5128432eb41cd5194fe9cac0b2314c5819 100644 |
| --- a/chrome/browser/omnibox/omnibox_field_trial.cc |
| +++ b/chrome/browser/omnibox/omnibox_field_trial.cc |
| @@ -11,6 +11,7 @@ |
| #include "base/strings/string_split.h" |
| #include "base/strings/string_util.h" |
| #include "base/strings/stringprintf.h" |
| +#include "chrome/browser/autocomplete/autocomplete_input.h" |
|
Mark P
2013/08/09 23:27:15
This change doesn't need it, but this should've be
|
| #include "chrome/common/metrics/metrics_util.h" |
| #include "chrome/common/metrics/variations/variation_ids.h" |
| #include "chrome/common/metrics/variations/variations_util.h" |
| @@ -22,10 +23,10 @@ const char kHUPCullRedirectsFieldTrialName[] = "OmniboxHUPCullRedirects"; |
| const char kHUPCreateShorterMatchFieldTrialName[] = |
| "OmniboxHUPCreateShorterMatch"; |
| const char kStopTimerFieldTrialName[] = "OmniboxStopTimer"; |
| -const char kShortcutsScoringFieldTrialName[] = "OmniboxShortcutsScoring"; |
| const char kBundledExperimentFieldTrialName[] = "OmniboxBundledExperimentV1"; |
| // Rule names used by the bundled experiment. |
| +const char kShortcutsScoringMaxRelevanceRule[] = "ShortcutsScoringMaxRelevance"; |
| const char kSearchHistoryRule[] = "SearchHistory"; |
| const char kDemoteByTypeRule[] = "DemoteByType"; |
| @@ -206,18 +207,18 @@ bool OmniboxFieldTrial::InZeroSuggestFieldTrial() { |
| return false; |
| } |
| -// If the active group name starts with "MaxRelevance_", extract the |
| -// int that immediately following that, returning true on success. |
| -bool OmniboxFieldTrial::ShortcutsScoringMaxRelevance(int* max_relevance) { |
| - std::string group_name = |
| - base::FieldTrialList::FindFullName(kShortcutsScoringFieldTrialName); |
| - const char kMaxRelevanceGroupPrefix[] = "MaxRelevance_"; |
| - if (!StartsWithASCII(group_name, kMaxRelevanceGroupPrefix, true)) |
| +bool OmniboxFieldTrial::ShortcutsScoringMaxRelevance( |
| + AutocompleteInput::PageClassification current_page_classification, |
| + int* max_relevance) { |
| + // The value of the rule is an integer displayed as a string that |
|
Peter Kasting
2013/08/09 23:33:15
Nit: "...is a string that encodes an integer conta
Mark P
2013/08/10 00:11:56
Okay. That's less backwards than my sentence. Do
|
| + // contains the max relevance. |
| + const std::string& max_relevance_str = |
| + OmniboxFieldTrial::GetValueForRuleInContext( |
| + kShortcutsScoringMaxRelevanceRule, current_page_classification); |
| + if (max_relevance_str.empty()) |
| return false; |
| - if (!base::StringToInt(base::StringPiece( |
| - group_name.substr(strlen(kMaxRelevanceGroupPrefix))), |
| - max_relevance)) { |
| - LOG(WARNING) << "Malformed MaxRelevance string: " << group_name; |
| + if (!base::StringToInt(max_relevance_str, max_relevance)) { |
| + LOG(WARNING) << "Malformed MaxRelevance string: " << max_relevance_str; |
|
Peter Kasting
2013/08/09 23:33:15
While here, consider removing this LOG unless you
Mark P
2013/08/10 00:11:56
Good point. This warning is not useful. Removed.
|
| return false; |
| } |
| return true; |