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 #include "components/omnibox/omnibox_field_trial.h" | 5 #include "components/omnibox/omnibox_field_trial.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 kBundledExperimentFieldTrialName, | 299 kBundledExperimentFieldTrialName, |
300 kHQPAllowMatchInTLDRule) == "true"; | 300 kHQPAllowMatchInTLDRule) == "true"; |
301 } | 301 } |
302 | 302 |
303 bool OmniboxFieldTrial::HQPAllowMatchInSchemeValue() { | 303 bool OmniboxFieldTrial::HQPAllowMatchInSchemeValue() { |
304 return variations::GetVariationParamValue( | 304 return variations::GetVariationParamValue( |
305 kBundledExperimentFieldTrialName, | 305 kBundledExperimentFieldTrialName, |
306 kHQPAllowMatchInSchemeRule) == "true"; | 306 kHQPAllowMatchInSchemeRule) == "true"; |
307 } | 307 } |
308 | 308 |
309 bool OmniboxFieldTrial::BookmarksIndexURLsValue() { | |
310 return variations::GetVariationParamValue( | |
311 kBundledExperimentFieldTrialName, | |
312 kBookmarksIndexURLsRule) == "true"; | |
313 } | |
314 | |
315 bool OmniboxFieldTrial::DisableInlining() { | 309 bool OmniboxFieldTrial::DisableInlining() { |
316 return variations::GetVariationParamValue( | 310 return variations::GetVariationParamValue( |
317 kBundledExperimentFieldTrialName, | 311 kBundledExperimentFieldTrialName, |
318 kDisableInliningRule) == "true"; | 312 kDisableInliningRule) == "true"; |
319 } | 313 } |
320 | 314 |
321 bool OmniboxFieldTrial::EnableAnswersInSuggest() { | 315 bool OmniboxFieldTrial::EnableAnswersInSuggest() { |
322 const CommandLine* cl = CommandLine::ForCurrentProcess(); | 316 const CommandLine* cl = CommandLine::ForCurrentProcess(); |
323 if (cl->HasSwitch(switches::kDisableAnswersInSuggest)) | 317 if (cl->HasSwitch(switches::kDisableAnswersInSuggest)) |
324 return false; | 318 return false; |
(...skipping 23 matching lines...) Expand all Loading... |
348 "ShortcutsScoringMaxRelevance"; | 342 "ShortcutsScoringMaxRelevance"; |
349 const char OmniboxFieldTrial::kSearchHistoryRule[] = "SearchHistory"; | 343 const char OmniboxFieldTrial::kSearchHistoryRule[] = "SearchHistory"; |
350 const char OmniboxFieldTrial::kDemoteByTypeRule[] = "DemoteByType"; | 344 const char OmniboxFieldTrial::kDemoteByTypeRule[] = "DemoteByType"; |
351 const char OmniboxFieldTrial::kHQPBookmarkValueRule[] = | 345 const char OmniboxFieldTrial::kHQPBookmarkValueRule[] = |
352 "HQPBookmarkValue"; | 346 "HQPBookmarkValue"; |
353 const char OmniboxFieldTrial::kHQPAllowMatchInTLDRule[] = "HQPAllowMatchInTLD"; | 347 const char OmniboxFieldTrial::kHQPAllowMatchInTLDRule[] = "HQPAllowMatchInTLD"; |
354 const char OmniboxFieldTrial::kHQPAllowMatchInSchemeRule[] = | 348 const char OmniboxFieldTrial::kHQPAllowMatchInSchemeRule[] = |
355 "HQPAllowMatchInScheme"; | 349 "HQPAllowMatchInScheme"; |
356 const char OmniboxFieldTrial::kZeroSuggestRule[] = "ZeroSuggest"; | 350 const char OmniboxFieldTrial::kZeroSuggestRule[] = "ZeroSuggest"; |
357 const char OmniboxFieldTrial::kZeroSuggestVariantRule[] = "ZeroSuggestVariant"; | 351 const char OmniboxFieldTrial::kZeroSuggestVariantRule[] = "ZeroSuggestVariant"; |
358 const char OmniboxFieldTrial::kBookmarksIndexURLsRule[] = "BookmarksIndexURLs"; | |
359 const char OmniboxFieldTrial::kDisableInliningRule[] = "DisableInlining"; | 352 const char OmniboxFieldTrial::kDisableInliningRule[] = "DisableInlining"; |
360 const char OmniboxFieldTrial::kAnswersInSuggestRule[] = "AnswersInSuggest"; | 353 const char OmniboxFieldTrial::kAnswersInSuggestRule[] = "AnswersInSuggest"; |
361 const char OmniboxFieldTrial::kAddUWYTMatchEvenIfPromotedURLsRule[] = | 354 const char OmniboxFieldTrial::kAddUWYTMatchEvenIfPromotedURLsRule[] = |
362 "AddUWYTMatchEvenIfPromotedURLs"; | 355 "AddUWYTMatchEvenIfPromotedURLs"; |
363 const char OmniboxFieldTrial::kDisplayHintTextWhenPossibleRule[] = | 356 const char OmniboxFieldTrial::kDisplayHintTextWhenPossibleRule[] = |
364 "DisplayHintTextWhenPossible"; | 357 "DisplayHintTextWhenPossible"; |
365 | 358 |
366 const char OmniboxFieldTrial::kHUPNewScoringEnabledParam[] = | 359 const char OmniboxFieldTrial::kHUPNewScoringEnabledParam[] = |
367 "HUPExperimentalScoringEnabled"; | 360 "HUPExperimentalScoringEnabled"; |
368 const char OmniboxFieldTrial::kHUPNewScoringTypedCountRelevanceCapParam[] = | 361 const char OmniboxFieldTrial::kHUPNewScoringTypedCountRelevanceCapParam[] = |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 if (it != params.end()) | 426 if (it != params.end()) |
434 return it->second; | 427 return it->second; |
435 // Fall back to the global instant extended context. | 428 // Fall back to the global instant extended context. |
436 it = params.find(rule + ":" + page_classification_str + ":*"); | 429 it = params.find(rule + ":" + page_classification_str + ":*"); |
437 if (it != params.end()) | 430 if (it != params.end()) |
438 return it->second; | 431 return it->second; |
439 // Look up rule in the global context. | 432 // Look up rule in the global context. |
440 it = params.find(rule + ":*:*"); | 433 it = params.find(rule + ":*:*"); |
441 return (it != params.end()) ? it->second : std::string(); | 434 return (it != params.end()) ? it->second : std::string(); |
442 } | 435 } |
OLD | NEW |