OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ | 5 #ifndef COMPONENTS_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ |
6 #define COMPONENTS_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ | 6 #define COMPONENTS_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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
274 // --------------------------------------------------------- | 274 // --------------------------------------------------------- |
275 // For the DisplayHintTextWhenPossible experiment that's part of the | 275 // For the DisplayHintTextWhenPossible experiment that's part of the |
276 // bundled omnibox field trial. | 276 // bundled omnibox field trial. |
277 | 277 |
278 // Returns true if the omnibox should display hint text (Search | 278 // Returns true if the omnibox should display hint text (Search |
279 // <search engine> or type URL) when possible (i.e., the omnibox | 279 // <search engine> or type URL) when possible (i.e., the omnibox |
280 // is otherwise non-empty). | 280 // is otherwise non-empty). |
281 static bool DisplayHintTextWhenPossible(); | 281 static bool DisplayHintTextWhenPossible(); |
282 | 282 |
283 // --------------------------------------------------------- | 283 // --------------------------------------------------------- |
284 // For SearchProvider related experiments. | |
285 | |
286 // Returns true if the search provider should not be caching results. | |
287 static bool DisableResultsCaching(); | |
288 | |
289 // Returns how the search provider should poll Suggest. Currently, we support | |
290 // measuring polling delay from the last keystroke or last suggest request. | |
291 static void GetSuggestPollingStrategy(bool* from_last_keystroke, | |
292 int* polling_delay_ms); | |
293 | |
294 // --------------------------------------------------------- | |
284 // Exposed publicly for the sake of unittests. | 295 // Exposed publicly for the sake of unittests. |
285 static const char kBundledExperimentFieldTrialName[]; | 296 static const char kBundledExperimentFieldTrialName[]; |
286 // Rule names used by the bundled experiment. | 297 // Rule names used by the bundled experiment. |
287 static const char kShortcutsScoringMaxRelevanceRule[]; | 298 static const char kShortcutsScoringMaxRelevanceRule[]; |
288 static const char kSearchHistoryRule[]; | 299 static const char kSearchHistoryRule[]; |
289 static const char kDemoteByTypeRule[]; | 300 static const char kDemoteByTypeRule[]; |
290 static const char kHQPBookmarkValueRule[]; | 301 static const char kHQPBookmarkValueRule[]; |
291 static const char kHQPDiscountFrecencyWhenFewVisitsRule[]; | 302 static const char kHQPDiscountFrecencyWhenFewVisitsRule[]; |
292 static const char kHQPAllowMatchInTLDRule[]; | 303 static const char kHQPAllowMatchInTLDRule[]; |
293 static const char kHQPAllowMatchInSchemeRule[]; | 304 static const char kHQPAllowMatchInSchemeRule[]; |
294 static const char kZeroSuggestRule[]; | 305 static const char kZeroSuggestRule[]; |
295 static const char kZeroSuggestVariantRule[]; | 306 static const char kZeroSuggestVariantRule[]; |
296 static const char kDisableInliningRule[]; | 307 static const char kDisableInliningRule[]; |
297 static const char kAnswersInSuggestRule[]; | 308 static const char kAnswersInSuggestRule[]; |
298 static const char kAddUWYTMatchEvenIfPromotedURLsRule[]; | 309 static const char kAddUWYTMatchEvenIfPromotedURLsRule[]; |
299 static const char kDisplayHintTextWhenPossibleRule[]; | 310 static const char kDisplayHintTextWhenPossibleRule[]; |
311 static const char kDisableResultsCachingRule[]; | |
312 static const char kMeasureSuggestPollingDelayFromLastKeystrokeRule[]; | |
313 static const char kSuggestPollingDelayMsRule[]; | |
300 | 314 |
301 // Parameter names used by the HUP new scoring experiments. | 315 // Parameter names used by the HUP new scoring experiments. |
302 static const char kHUPNewScoringEnabledParam[]; | 316 static const char kHUPNewScoringEnabledParam[]; |
303 static const char kHUPNewScoringTypedCountRelevanceCapParam[]; | 317 static const char kHUPNewScoringTypedCountRelevanceCapParam[]; |
304 static const char kHUPNewScoringTypedCountHalfLifeTimeParam[]; | 318 static const char kHUPNewScoringTypedCountHalfLifeTimeParam[]; |
305 static const char kHUPNewScoringTypedCountScoreBucketsParam[]; | 319 static const char kHUPNewScoringTypedCountScoreBucketsParam[]; |
306 static const char kHUPNewScoringVisitedCountRelevanceCapParam[]; | 320 static const char kHUPNewScoringVisitedCountRelevanceCapParam[]; |
307 static const char kHUPNewScoringVisitedCountHalfLifeTimeParam[]; | 321 static const char kHUPNewScoringVisitedCountHalfLifeTimeParam[]; |
308 static const char kHUPNewScoringVisitedCountScoreBucketsParam[]; | 322 static const char kHUPNewScoringVisitedCountScoreBucketsParam[]; |
309 | 323 |
324 // The amount of time to wait before sending a new suggest request after the | |
325 // previous one. Non-const because some unittests modify this value. | |
Mark P
2014/10/22 20:33:07
one
->
one unless overridden by a field trial para
Bart N.
2014/10/22 22:04:56
Done.
| |
326 static int kMinimumTimeBetweenSuggestQueriesMs; | |
Mark P
2014/10/22 20:33:07
add Default in this name somewhere
Bart N.
2014/10/22 22:04:57
Done.
| |
327 | |
310 private: | 328 private: |
311 friend class OmniboxFieldTrialTest; | 329 friend class OmniboxFieldTrialTest; |
312 | 330 |
313 // The bundled omnibox experiment comes with a set of parameters | 331 // The bundled omnibox experiment comes with a set of parameters |
314 // (key-value pairs). Each key indicates a certain rule that applies in | 332 // (key-value pairs). Each key indicates a certain rule that applies in |
315 // a certain context. The value indicates what the consequences of | 333 // a certain context. The value indicates what the consequences of |
316 // applying the rule are. For example, the value of a SearchHistory rule | 334 // applying the rule are. For example, the value of a SearchHistory rule |
317 // in the context of a search results page might indicate that we should | 335 // in the context of a search results page might indicate that we should |
318 // prevent search history matches from inlining. | 336 // prevent search history matches from inlining. |
319 // | 337 // |
320 // This function returns the value associated with the |rule| that applies | 338 // This function returns the value associated with the |rule| that applies |
321 // in the current context (which currently consists of |page_classification| | 339 // in the current context (which currently consists of |page_classification| |
322 // and whether Instant Extended is enabled). If no such rule exists in the | 340 // and whether Instant Extended is enabled). If no such rule exists in the |
323 // current context, fall back to the rule in various wildcard contexts and | 341 // current context, fall back to the rule in various wildcard contexts and |
324 // return its value if found. If the rule remains unfound in the global | 342 // return its value if found. If the rule remains unfound in the global |
325 // context, returns the empty string. For more details, including how we | 343 // context, returns the empty string. For more details, including how we |
326 // prioritize different wildcard contexts, see the implementation. How to | 344 // prioritize different wildcard contexts, see the implementation. How to |
327 // interpret the value is left to the caller; this is rule-dependent. | 345 // interpret the value is left to the caller; this is rule-dependent. |
328 static std::string GetValueForRuleInContext( | 346 static std::string GetValueForRuleInContext( |
329 const std::string& rule, | 347 const std::string& rule, |
330 metrics::OmniboxEventProto::PageClassification page_classification); | 348 metrics::OmniboxEventProto::PageClassification page_classification); |
331 | 349 |
332 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); | 350 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); |
333 }; | 351 }; |
334 | 352 |
335 #endif // COMPONENTS_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ | 353 #endif // COMPONENTS_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ |
OLD | NEW |