| 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 <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 // Returns true if the omnibox will reorder matches, in the provided | 168 // Returns true if the omnibox will reorder matches, in the provided |
| 169 // |current_page_classification| context so that a match that's allowed to | 169 // |current_page_classification| context so that a match that's allowed to |
| 170 // be the default match will appear first. This means AutocompleteProviders | 170 // be the default match will appear first. This means AutocompleteProviders |
| 171 // can score matches however they desire without regard to making sure the | 171 // can score matches however they desire without regard to making sure the |
| 172 // top match when all the matches from all providers are merged is a legal | 172 // top match when all the matches from all providers are merged is a legal |
| 173 // default match. | 173 // default match. |
| 174 static bool ReorderForLegalDefaultMatch( | 174 static bool ReorderForLegalDefaultMatch( |
| 175 AutocompleteInput::PageClassification current_page_classification); | 175 AutocompleteInput::PageClassification current_page_classification); |
| 176 | 176 |
| 177 // --------------------------------------------------------- | 177 // --------------------------------------------------------- |
| 178 // For the HQPBookmarkValue experiment that's part of the |
| 179 // bundled omnibox field trial. |
| 180 |
| 181 // Returns the value an untyped visit to a bookmark should receive. |
| 182 // Compare this value with the default of 1 for non-bookmarked untyped |
| 183 // visits to pages and the default of 20 for typed visits. Returns |
| 184 // 1 if the bookmark value experiment isn't active. |
| 185 static int HQPBookmarkValue(); |
| 186 |
| 187 // --------------------------------------------------------- |
| 178 // Exposed publicly for the sake of unittests. | 188 // Exposed publicly for the sake of unittests. |
| 179 static const char kBundledExperimentFieldTrialName[]; | 189 static const char kBundledExperimentFieldTrialName[]; |
| 180 // Rule names used by the bundled experiment. | 190 // Rule names used by the bundled experiment. |
| 181 static const char kShortcutsScoringMaxRelevanceRule[]; | 191 static const char kShortcutsScoringMaxRelevanceRule[]; |
| 182 static const char kSearchHistoryRule[]; | 192 static const char kSearchHistoryRule[]; |
| 183 static const char kDemoteByTypeRule[]; | 193 static const char kDemoteByTypeRule[]; |
| 184 static const char kUndemotableTopTypeRule[]; | 194 static const char kUndemotableTopTypeRule[]; |
| 185 static const char kReorderForLegalDefaultMatchRule[]; | 195 static const char kReorderForLegalDefaultMatchRule[]; |
| 196 static const char kHQPBookmarkValueRule[]; |
| 186 // Rule values. | 197 // Rule values. |
| 187 static const char kReorderForLegalDefaultMatchRuleEnabled[]; | 198 static const char kReorderForLegalDefaultMatchRuleEnabled[]; |
| 188 | 199 |
| 189 private: | 200 private: |
| 190 friend class OmniboxFieldTrialTest; | 201 friend class OmniboxFieldTrialTest; |
| 191 | 202 |
| 192 // The bundled omnibox experiment comes with a set of parameters | 203 // The bundled omnibox experiment comes with a set of parameters |
| 193 // (key-value pairs). Each key indicates a certain rule that applies in | 204 // (key-value pairs). Each key indicates a certain rule that applies in |
| 194 // a certain context. The value indicates what the consequences of | 205 // a certain context. The value indicates what the consequences of |
| 195 // applying the rule are. For example, the value of a SearchHistory rule | 206 // applying the rule are. For example, the value of a SearchHistory rule |
| 196 // in the context of a search results page might indicate that we should | 207 // in the context of a search results page might indicate that we should |
| 197 // prevent search history matches from inlining. | 208 // prevent search history matches from inlining. |
| 198 // | 209 // |
| 199 // This function returns the value associated with the |rule| that applies | 210 // This function returns the value associated with the |rule| that applies |
| 200 // in the current context (which currently consists of |page_classification| | 211 // in the current context (which currently consists of |page_classification| |
| 201 // and whether Instant Extended is enabled). If no such rule exists in the | 212 // and whether Instant Extended is enabled). If no such rule exists in the |
| 202 // current context, fall back to the rule in various wildcard contexts and | 213 // current context, fall back to the rule in various wildcard contexts and |
| 203 // return its value if found. If the rule remains unfound in the global | 214 // return its value if found. If the rule remains unfound in the global |
| 204 // context, returns the empty string. For more details, including how we | 215 // context, returns the empty string. For more details, including how we |
| 205 // prioritize different wildcard contexts, see the implementation. How to | 216 // prioritize different wildcard contexts, see the implementation. How to |
| 206 // interpret the value is left to the caller; this is rule-dependent. | 217 // interpret the value is left to the caller; this is rule-dependent. |
| 207 static std::string GetValueForRuleInContext( | 218 static std::string GetValueForRuleInContext( |
| 208 const std::string& rule, | 219 const std::string& rule, |
| 209 AutocompleteInput::PageClassification page_classification); | 220 AutocompleteInput::PageClassification page_classification); |
| 210 | 221 |
| 211 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); | 222 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); |
| 212 }; | 223 }; |
| 213 | 224 |
| 214 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ | 225 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ |
| OLD | NEW |