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

Side by Side Diff: chrome/browser/omnibox/omnibox_field_trial.h

Issue 18878007: Omnibox: Make the Controller Reorder Matches for Inlining (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ 5 #ifndef CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_
6 #define CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ 6 #define CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // trial. 130 // trial.
131 131
132 // If the user is in an experiment group that, in the provided 132 // If the user is in an experiment group that, in the provided
133 // |current_page_classification| context, demotes the relevance scores 133 // |current_page_classification| context, demotes the relevance scores
134 // of certain types of matches, populates the |demotions_by_type| map 134 // of certain types of matches, populates the |demotions_by_type| map
135 // appropriately. Otherwise, clears |demotions_by_type|. 135 // appropriately. Otherwise, clears |demotions_by_type|.
136 static void GetDemotionsByType( 136 static void GetDemotionsByType(
137 AutocompleteInput::PageClassification current_page_classification, 137 AutocompleteInput::PageClassification current_page_classification,
138 DemotionMultipliers* demotions_by_type); 138 DemotionMultipliers* demotions_by_type);
139 139
140 // ---------------------------------------------------------
141 // For the ReorderForLegalDefaultMatch experiment that's part of the
142 // bundled omnibox field trial.
143
144 // Returns true if the omnibox will reorder matches, in the provided
145 // |current_page_classification| context so that a match that's allowed to
146 // be the default match will appear first. This means AutocompleteProviders
147 // can score matches however they desire without regard to making sure the
148 // top match when all the matches from all providers are merged is a legal
149 // default match.
150 static bool ReorderForLegalDefaultMatch(
151 AutocompleteInput::PageClassification current_page_classification);
152
153 // ---------------------------------------------------------
154 // Exposed publicly for the sake of unittests.
155 static const char kBundledExperimentFieldTrialName[];
156 // Rule names used by the bundled experiment.
157 static const char kSearchHistoryRule[];
158 static const char kDemoteByTypeRule[];
159 static const char kReorderForLegalDefaultMatchRule[];
160 // Rule values.
161 static const char kReorderForLegalDefaultMatchRuleEnabled[];
162
140 private: 163 private:
141 friend class OmniboxFieldTrialTest; 164 friend class OmniboxFieldTrialTest;
142 165
143 // The bundled omnibox experiment comes with a set of parameters 166 // The bundled omnibox experiment comes with a set of parameters
144 // (key-value pairs). Each key indicates a certain rule that applies in 167 // (key-value pairs). Each key indicates a certain rule that applies in
145 // a certain context. The value indicates what the consequences of 168 // a certain context. The value indicates what the consequences of
146 // applying the rule are. For example, the value of a SearchHistory rule 169 // applying the rule are. For example, the value of a SearchHistory rule
147 // in the context of a search results page might indicate that we should 170 // in the context of a search results page might indicate that we should
148 // prevent search history matches from inlining. 171 // prevent search history matches from inlining.
149 // 172 //
150 // This function returns the value associated with the |rule| that applies 173 // This function returns the value associated with the |rule| that applies
151 // in the current context (which currently consists of |page_classification| 174 // in the current context (which currently consists of |page_classification|
152 // and whether Instant Extended is enabled). If no such rule exists in the 175 // and whether Instant Extended is enabled). If no such rule exists in the
153 // current context, fall back to the rule in various wildcard contexts and 176 // current context, fall back to the rule in various wildcard contexts and
154 // return its value if found. If the rule remains unfound in the global 177 // return its value if found. If the rule remains unfound in the global
155 // context, returns the empty string. For more details, including how we 178 // context, returns the empty string. For more details, including how we
156 // prioritize different wildcard contexts, see the implementation. How to 179 // prioritize different wildcard contexts, see the implementation. How to
157 // interpret the value is left to the caller; this is rule-dependent. 180 // interpret the value is left to the caller; this is rule-dependent.
158 static std::string GetValueForRuleInContext( 181 static std::string GetValueForRuleInContext(
159 const std::string& rule, 182 const std::string& rule,
160 AutocompleteInput::PageClassification page_classification); 183 AutocompleteInput::PageClassification page_classification);
161 184
162 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); 185 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial);
163 }; 186 };
164 187
165 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ 188 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698