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 4ec2c5c55e2d808d6c969ad051b8489e7064564f..da169432c186c24c658299bacdf43e67d94fe015 100644 |
--- a/chrome/browser/omnibox/omnibox_field_trial.cc |
+++ b/chrome/browser/omnibox/omnibox_field_trial.cc |
@@ -22,6 +22,7 @@ const char kHUPCullRedirectsFieldTrialName[] = "OmniboxHUPCullRedirects"; |
const char kHUPCreateShorterMatchFieldTrialName[] = |
"OmniboxHUPCreateShorterMatch"; |
const char kStopTimerFieldTrialName[] = "OmniboxStopTimer"; |
+const char kShortcutsScoringFieldTrialName[] = "OmniboxShortcutsScoring"; |
// The autocomplete dynamic field trial name prefix. Each field trial is |
// configured dynamically and is retrieved automatically by Chrome during |
@@ -240,3 +241,20 @@ 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)) |
+ return false; |
+ if (!base::StringToInt(base::StringPiece( |
+ group_name.substr(strlen(kMaxRelevanceGroupPrefix))), |
+ max_relevance)) { |
+ LOG(WARNING) << "Malformed MaxRelevance string: " << group_name; |
+ return false; |
+ } |
+ return true; |
+} |