| 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "chrome/browser/autocomplete/autocomplete_input.h" |
| 12 | 13 |
| 13 // This class manages the Omnibox field trials. | 14 // This class manages the Omnibox field trials. |
| 14 class OmniboxFieldTrial { | 15 class OmniboxFieldTrial { |
| 15 public: | 16 public: |
| 16 // Creates the static field trial groups. | 17 // Creates the static field trial groups. |
| 17 // *** MUST NOT BE CALLED MORE THAN ONCE. *** | 18 // *** MUST NOT BE CALLED MORE THAN ONCE. *** |
| 18 static void ActivateStaticTrials(); | 19 static void ActivateStaticTrials(); |
| 19 | 20 |
| 20 // Activates all dynamic field trials. The main difference between | 21 // Activates all dynamic field trials. The main difference between |
| 21 // the autocomplete dynamic and static field trials is that the former | 22 // the autocomplete dynamic and static field trials is that the former |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // relevance score and some attenuating factors that are all between | 97 // relevance score and some attenuating factors that are all between |
| 97 // 0 and 1. (Note that Shortcuts results may have their scores | 98 // 0 and 1. (Note that Shortcuts results may have their scores |
| 98 // reduced later if the assigned score is higher than allowed for | 99 // reduced later if the assigned score is higher than allowed for |
| 99 // non-inlineable results. Shortcuts results are not allowed to be | 100 // non-inlineable results. Shortcuts results are not allowed to be |
| 100 // inlined.) | 101 // inlined.) |
| 101 static bool ShortcutsScoringMaxRelevance(int* max_relevance); | 102 static bool ShortcutsScoringMaxRelevance(int* max_relevance); |
| 102 | 103 |
| 103 // --------------------------------------------------------- | 104 // --------------------------------------------------------- |
| 104 // For the SearchHistory field trial. | 105 // For the SearchHistory field trial. |
| 105 | 106 |
| 106 // Returns true if the user is in the experiment group that scores | 107 // Returns true if the user is in the experiment group that, in the |
| 107 // search history query suggestions less aggressively so that they don't | 108 // provided |current_page_classification| context, scores search history |
| 108 // inline. | 109 // query suggestions less aggressively so that they don't inline. |
| 109 static bool SearchHistoryPreventInlining(); | 110 static bool SearchHistoryPreventInlining( |
| 111 AutocompleteInput::PageClassification current_page_classification); |
| 110 | 112 |
| 111 // Returns true if the user is in the experiment group that disables | 113 // Returns true if the user is in the experiment group that, in the |
| 112 // all query suggestions from search history. | 114 // provided |current_page_classification| context, disables all query |
| 113 static bool SearchHistoryDisable(); | 115 // suggestions from search history. |
| 116 static bool SearchHistoryDisable( |
| 117 AutocompleteInput::PageClassification current_page_classification); |
| 114 | 118 |
| 115 private: | 119 private: |
| 120 // Returns the "consequences" for the |rule| that applies in the context |
| 121 // of |current_page_classification|. If no such rule exists, looks for |
| 122 // that rule in the global context and return it if found. If the rule |
| 123 // remains unfound in the global context, returns the empty string. For |
| 124 // more details, see the implementation. |
| 125 static std::string GetConsequencesOfRuleInPageClassificationContext( |
| 126 AutocompleteInput::PageClassification current_page_classification, |
| 127 const std::string& rule); |
| 128 |
| 116 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); | 129 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); |
| 117 }; | 130 }; |
| 118 | 131 |
| 119 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ | 132 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ |
| OLD | NEW |