Chromium Code Reviews| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 // This class manages the Omnibox field trials. | 85 // This class manages the Omnibox field trials. |
| 86 class OmniboxFieldTrial { | 86 class OmniboxFieldTrial { |
| 87 public: | 87 public: |
| 88 // A mapping that contains multipliers indicating that matches of the | 88 // A mapping that contains multipliers indicating that matches of the |
| 89 // specified type should have their relevance score multiplied by the | 89 // specified type should have their relevance score multiplied by the |
| 90 // given number. Omitted types are assumed to have multipliers of 1.0. | 90 // given number. Omitted types are assumed to have multipliers of 1.0. |
| 91 typedef std::map<AutocompleteMatchType::Type, float> DemotionMultipliers; | 91 typedef std::map<AutocompleteMatchType::Type, float> DemotionMultipliers; |
| 92 | 92 |
| 93 // Creates the static field trial groups. | 93 // Creates the static field trial groups. |
| 94 // *** MUST NOT BE CALLED MORE THAN ONCE. *** | 94 // *** MUST NOT BE CALLED MORE THAN ONCE. *** |
| 95 static void ActivateStaticTrials(); | 95 static void ActivateStaticTrials(); |
|
Mark P
2014/08/06 20:13:40
How does this compile if you deleted the function
Steven Holte
2014/08/06 20:43:12
Done. It compiles regardless because there are no
| |
| 96 | 96 |
| 97 // Activates all dynamic field trials. The main difference between | 97 // Activates all dynamic field trials. The main difference between |
| 98 // the autocomplete dynamic and static field trials is that the former | 98 // the autocomplete dynamic and static field trials is that the former |
| 99 // don't require any code changes on the Chrome side as they are controlled | 99 // don't require any code changes on the Chrome side as they are controlled |
| 100 // on the server side. Chrome binary simply propagates all necessary | 100 // on the server side. Chrome binary simply propagates all necessary |
| 101 // information through the X-Client-Data header. | 101 // information through the X-Client-Data header. |
| 102 // This method, unlike ActivateStaticTrials(), may be called multiple times. | 102 // This method, unlike ActivateStaticTrials(), may be called multiple times. |
| 103 static void ActivateDynamicTrials(); | 103 static void ActivateDynamicTrials(); |
|
Mark P
2014/08/06 20:13:40
Please revise the above comment in light of deleti
Steven Holte
2014/08/06 20:43:12
Done.
| |
| 104 | 104 |
| 105 // Returns a bitmap containing AutocompleteProvider::Type values | 105 // Returns a bitmap containing AutocompleteProvider::Type values |
| 106 // that should be disabled in AutocompleteController. | 106 // that should be disabled in AutocompleteController. |
| 107 // This method simply goes over all autocomplete dynamic field trial groups | 107 // This method simply goes over all autocomplete dynamic field trial groups |
| 108 // and looks for group names like "ProvidersDisabled_NNN" where NNN is | 108 // and looks for group names like "ProvidersDisabled_NNN" where NNN is |
| 109 // an integer corresponding to a bitmap mask. All extracted bitmaps | 109 // an integer corresponding to a bitmap mask. All extracted bitmaps |
| 110 // are OR-ed together and returned as the final result. | 110 // are OR-ed together and returned as the final result. |
| 111 static int GetDisabledProviderTypes(); | 111 static int GetDisabledProviderTypes(); |
| 112 | 112 |
| 113 // Returns whether the user is in any dynamic field trial where the | 113 // Returns whether the user is in any dynamic field trial where the |
| 114 // group has a the prefix |group_prefix|. | 114 // group has a the prefix |group_prefix|. |
| 115 static bool HasDynamicFieldTrialGroupPrefix(const char *group_prefix); | 115 static bool HasDynamicFieldTrialGroupPrefix(const char *group_prefix); |
| 116 | 116 |
| 117 // --------------------------------------------------------- | 117 // --------------------------------------------------------- |
| 118 // For the suggest field trial. | 118 // For the suggest field trial. |
| 119 | 119 |
| 120 // Populates |field_trial_hash| with hashes of the active suggest field trial | 120 // Populates |field_trial_hash| with hashes of the active suggest field trial |
| 121 // names, if any. | 121 // names, if any. |
| 122 static void GetActiveSuggestFieldTrialHashes( | 122 static void GetActiveSuggestFieldTrialHashes( |
| 123 std::vector<uint32>* field_trial_hash); | 123 std::vector<uint32>* field_trial_hash); |
| 124 | 124 |
| 125 // --------------------------------------------------------- | 125 // --------------------------------------------------------- |
| 126 // For the HistoryURL provider disable culling redirects field trial. | |
| 127 | |
| 128 // Returns whether the user is in any group for this field trial. | |
| 129 // (Should always be true unless initialization went wrong.) | |
| 130 static bool InHUPCullRedirectsFieldTrial(); | |
| 131 | |
| 132 // Returns whether we should disable culling of redirects in | |
| 133 // HistoryURL provider. | |
| 134 static bool InHUPCullRedirectsFieldTrialExperimentGroup(); | |
| 135 | |
| 136 // --------------------------------------------------------- | |
| 137 // For the HistoryURL provider disable creating a shorter match | |
| 138 // field trial. | |
| 139 | |
| 140 // Returns whether the user is in any group for this field trial. | |
| 141 // (Should always be true unless initialization went wrong.) | |
| 142 static bool InHUPCreateShorterMatchFieldTrial(); | |
| 143 | |
| 144 // Returns whether we should disable creating a shorter match in | |
| 145 // HistoryURL provider. | |
| 146 static bool InHUPCreateShorterMatchFieldTrialExperimentGroup(); | |
| 147 | |
| 148 // --------------------------------------------------------- | |
| 149 // For the AutocompleteController "stop timer" field trial. | 126 // For the AutocompleteController "stop timer" field trial. |
| 150 | 127 |
| 151 // Returns the duration to be used for the AutocompleteController's stop | 128 // Returns the duration to be used for the AutocompleteController's stop |
| 152 // timer. Returns the default value of 1.5 seconds if the stop timer | 129 // timer. Returns the default value of 1.5 seconds if the stop timer |
| 153 // override experiment isn't active or if parsing the experiment-provided | 130 // override experiment isn't active or if parsing the experiment-provided |
| 154 // duration fails. | 131 // duration fails. |
| 155 static base::TimeDelta StopTimerFieldTrialDuration(); | 132 static base::TimeDelta StopTimerFieldTrialDuration(); |
| 156 | 133 |
| 157 // --------------------------------------------------------- | 134 // --------------------------------------------------------- |
| 158 // For the ZeroSuggestProvider field trial. | 135 // For the ZeroSuggestProvider field trial. |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 365 // prioritize different wildcard contexts, see the implementation. How to | 342 // prioritize different wildcard contexts, see the implementation. How to |
| 366 // interpret the value is left to the caller; this is rule-dependent. | 343 // interpret the value is left to the caller; this is rule-dependent. |
| 367 static std::string GetValueForRuleInContext( | 344 static std::string GetValueForRuleInContext( |
| 368 const std::string& rule, | 345 const std::string& rule, |
| 369 metrics::OmniboxEventProto::PageClassification page_classification); | 346 metrics::OmniboxEventProto::PageClassification page_classification); |
| 370 | 347 |
| 371 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); | 348 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); |
| 372 }; | 349 }; |
| 373 | 350 |
| 374 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ | 351 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ |
| OLD | NEW |