Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: chrome/browser/omnibox/omnibox_field_trial.h

Issue 20777006: Omnibox: Create Bundled Field Trial; Convert SearchHistory trial to it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: slightly revise comment Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/gtest_prod_util.h"
13 #include "chrome/browser/autocomplete/autocomplete_input.h"
12 14
13 // This class manages the Omnibox field trials. 15 // This class manages the Omnibox field trials.
14 class OmniboxFieldTrial { 16 class OmniboxFieldTrial {
15 public: 17 public:
16 // Creates the static field trial groups. 18 // Creates the static field trial groups.
17 // *** MUST NOT BE CALLED MORE THAN ONCE. *** 19 // *** MUST NOT BE CALLED MORE THAN ONCE. ***
18 static void ActivateStaticTrials(); 20 static void ActivateStaticTrials();
19 21
20 // Activates all dynamic field trials. The main difference between 22 // Activates all dynamic field trials. The main difference between
21 // the autocomplete dynamic and static field trials is that the former 23 // the autocomplete dynamic and static field trials is that the former
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // if the field trial is not active, etc., returns false. 96 // if the field trial is not active, etc., returns false.
95 // CalculateScore()'s return value is a product of this maximum 97 // CalculateScore()'s return value is a product of this maximum
96 // relevance score and some attenuating factors that are all between 98 // relevance score and some attenuating factors that are all between
97 // 0 and 1. (Note that Shortcuts results may have their scores 99 // 0 and 1. (Note that Shortcuts results may have their scores
98 // reduced later if the assigned score is higher than allowed for 100 // reduced later if the assigned score is higher than allowed for
99 // non-inlineable results. Shortcuts results are not allowed to be 101 // non-inlineable results. Shortcuts results are not allowed to be
100 // inlined.) 102 // inlined.)
101 static bool ShortcutsScoringMaxRelevance(int* max_relevance); 103 static bool ShortcutsScoringMaxRelevance(int* max_relevance);
102 104
103 // --------------------------------------------------------- 105 // ---------------------------------------------------------
104 // For the SearchHistory field trial. 106 // For the SearchHistory experiment that's part of the bundled omnibox
107 // field trial.
105 108
106 // Returns true if the user is in the experiment group that scores 109 // Returns true if the user is in the experiment group that, in the
Peter Kasting 2013/07/31 20:14:09 Nit: last "in" -> "given"? (2 places)
Mark P 2013/07/31 21:59:28 Done.
107 // search history query suggestions less aggressively so that they don't 110 // provided |current_page_classification| context, scores search history
108 // inline. 111 // query suggestions less aggressively so that they don't inline.
109 static bool SearchHistoryPreventInlining(); 112 static bool SearchHistoryPreventInlining(
113 AutocompleteInput::PageClassification current_page_classification);
110 114
111 // Returns true if the user is in the experiment group that disables 115 // Returns true if the user is in the experiment group that, in the
112 // all query suggestions from search history. 116 // provided |current_page_classification| context, disables all query
113 static bool SearchHistoryDisable(); 117 // suggestions from search history.
118 static bool SearchHistoryDisable(
119 AutocompleteInput::PageClassification current_page_classification);
114 120
115 private: 121 private:
122 FRIEND_TEST_ALL_PREFIXES(OmniboxFieldTrialTest,
123 GetConsequencesOfRuleInPageClassificationContext);
124
125 // Returns the "consequences" for the |rule| that applies in the context
Peter Kasting 2013/07/31 20:14:09 Nit: Putting "consequences" in quotes and never de
Mark P 2013/07/31 21:59:28 I think with the newly rewritten comment and remov
126 // of |current_page_classification|. If no such rule exists, looks for
127 // that rule in the global context and return it if found. If the rule
128 // remains unfound in the global context, returns the empty string. For
129 // more details, see the implementation.
130 static std::string GetConsequencesOfRuleInPageClassificationContext(
131 AutocompleteInput::PageClassification current_page_classification,
132 const std::string& rule);
133
116 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); 134 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial);
117 }; 135 };
118 136
119 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ 137 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698