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