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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // reduced later if the assigned score is higher than allowed for | 100 // reduced later if the assigned score is higher than allowed for |
101 // non-inlineable results. Shortcuts results are not allowed to be | 101 // non-inlineable results. Shortcuts results are not allowed to be |
102 // inlined.) | 102 // inlined.) |
103 static bool ShortcutsScoringMaxRelevance(int* max_relevance); | 103 static bool ShortcutsScoringMaxRelevance(int* max_relevance); |
104 | 104 |
105 // --------------------------------------------------------- | 105 // --------------------------------------------------------- |
106 // For the SearchHistory experiment that's part of the bundled omnibox | 106 // For the SearchHistory experiment that's part of the bundled omnibox |
107 // field trial. | 107 // field trial. |
108 | 108 |
109 // Returns true if the user is in the experiment group that, given the | 109 // Returns true if the user is in the experiment group that, given the |
110 // provided |current_page_classification| context, scores search history | 110 // provided |omnibox_context|, scores search history query suggestions less |
111 // query suggestions less aggressively so that they don't inline. | 111 // aggressively so that they don't inline. |
112 static bool SearchHistoryPreventInlining( | 112 static bool SearchHistoryPreventInlining( |
113 AutocompleteInput::PageClassification current_page_classification); | 113 AutocompleteInput::OmniboxContext omnibox_context); |
114 | 114 |
115 // Returns true if the user is in the experiment group that, given the | 115 // Returns true if the user is in the experiment group that, given the |
116 // provided |current_page_classification| context, disables all query | 116 // provided |omnibox_context|, disables all query suggestions from search |
117 // suggestions from search history. | 117 // history. |
118 static bool SearchHistoryDisable( | 118 static bool SearchHistoryDisable( |
119 AutocompleteInput::PageClassification current_page_classification); | 119 AutocompleteInput::OmniboxContext omnibox_context); |
120 | 120 |
121 private: | 121 private: |
122 FRIEND_TEST_ALL_PREFIXES(OmniboxFieldTrialTest, GetValueForRuleInContext); | 122 FRIEND_TEST_ALL_PREFIXES(OmniboxFieldTrialTest, GetValueForRuleInContext); |
123 | 123 |
124 // The bundled omnibox experiment comes with a set of parameters | 124 // The bundled omnibox experiment comes with a set of parameters |
125 // (key-value pairs). Each key indicates a certain rule that applies in | 125 // (key-value pairs). Each key indicates a certain rule that applies in |
126 // a certain context. The value indicates what the consequences of | 126 // a certain context. The value indicates what the consequences of |
127 // applying the rule are. For example, the value of a SearchHistory rule | 127 // applying the rule are. For example, the value of a SearchHistory rule |
128 // in the context of a search results page might indicate that we should | 128 // in the context of a search results page might indicate that we should |
129 // prevent search history matches from inlining. | 129 // prevent search history matches from inlining. |
130 // | 130 // |
131 // This function returns the value associated with the |rule| that applies | 131 // This function returns the value associated with the |rule| that applies |
132 // in the current context (which currently only consists of | 132 // in the current context (which currently only consists of |
133 // |page_classification| but will soon contain other features, some not | 133 // |omnibox_context| but will soon contain other features, some not |
134 // passed in as parameters, such as whether Instant Extended is enabled). | 134 // passed in as parameters, such as whether Instant Extended is enabled). |
135 // If no such rule exists in the current context, looks for that rule in | 135 // If no such rule exists in the current context, looks for that rule in |
136 // the global context and return its value if found. If the rule remains | 136 // the global context and return its value if found. If the rule remains |
137 // unfound in the global context, returns the empty string. For more | 137 // unfound in the global context, returns the empty string. For more |
138 // details, see the implementation. How to interpret the value is left | 138 // details, see the implementation. How to interpret the value is left |
139 // to the caller; this is rule-dependent. | 139 // to the caller; this is rule-dependent. |
140 static std::string GetValueForRuleInContext( | 140 static std::string GetValueForRuleInContext( |
141 const std::string& rule, | 141 const std::string& rule, |
142 AutocompleteInput::PageClassification page_classification); | 142 AutocompleteInput::OmniboxContext omnibox_context); |
143 | 143 |
144 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); | 144 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); |
145 }; | 145 }; |
146 | 146 |
147 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ | 147 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ |
OLD | NEW |