Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3367)

Unified Diff: chrome/browser/omnibox/omnibox_field_trial.cc

Issue 17261012: Omnibox: Add Field Trial to Make Shortcuts More Aggressive (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/omnibox/omnibox_field_trial.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+}
« no previous file with comments | « chrome/browser/omnibox/omnibox_field_trial.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698