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 #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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 private: | 140 private: |
141 FRIEND_TEST_ALL_PREFIXES(OmniboxFieldTrialTest, GetValueForRuleInContext); | 141 friend class OmniboxFieldTrialTest; |
142 | 142 |
143 // The bundled omnibox experiment comes with a set of parameters | 143 // The bundled omnibox experiment comes with a set of parameters |
144 // (key-value pairs). Each key indicates a certain rule that applies in | 144 // (key-value pairs). Each key indicates a certain rule that applies in |
145 // a certain context. The value indicates what the consequences of | 145 // a certain context. The value indicates what the consequences of |
146 // applying the rule are. For example, the value of a SearchHistory rule | 146 // 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 | 147 // in the context of a search results page might indicate that we should |
148 // prevent search history matches from inlining. | 148 // prevent search history matches from inlining. |
149 // | 149 // |
150 // This function returns the value associated with the |rule| that applies | 150 // This function returns the value associated with the |rule| that applies |
151 // in the current context (which currently only consists of | 151 // in the current context (which currently consists of |page_classification| |
152 // |page_classification| but will soon contain other features, some not | 152 // and whether Instant Extended is enabled). If no such rule exists in the |
153 // passed in as parameters, such as whether Instant Extended is enabled). | 153 // current context, fall back to the rule in various wildcard contexts and |
154 // If no such rule exists in the current context, looks for that rule in | 154 // return its value if found. If the rule remains unfound in the global |
155 // the global context and return its value if found. If the rule remains | 155 // context, returns the empty string. For more details, including how we |
156 // unfound in the global context, returns the empty string. For more | 156 // prioritize different wildcard contexts, see the implementation. How to |
157 // details, see the implementation. How to interpret the value is left | 157 // interpret the value is left to the caller; this is rule-dependent. |
158 // to the caller; this is rule-dependent. | |
159 static std::string GetValueForRuleInContext( | 158 static std::string GetValueForRuleInContext( |
160 const std::string& rule, | 159 const std::string& rule, |
161 AutocompleteInput::PageClassification page_classification); | 160 AutocompleteInput::PageClassification page_classification); |
162 | 161 |
163 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); | 162 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); |
164 }; | 163 }; |
165 | 164 |
166 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ | 165 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ |
OLD | NEW |