| 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 #include "chrome/browser/omnibox/omnibox_field_trial.h" | 5 #include "chrome/browser/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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 if (cl->HasSwitch(switches::kDisableAnswersInSuggest)) | 438 if (cl->HasSwitch(switches::kDisableAnswersInSuggest)) |
| 439 return false; | 439 return false; |
| 440 if (cl->HasSwitch(switches::kEnableAnswersInSuggest)) | 440 if (cl->HasSwitch(switches::kEnableAnswersInSuggest)) |
| 441 return true; | 441 return true; |
| 442 | 442 |
| 443 return chrome_variations::GetVariationParamValue( | 443 return chrome_variations::GetVariationParamValue( |
| 444 kBundledExperimentFieldTrialName, | 444 kBundledExperimentFieldTrialName, |
| 445 kAnswersInSuggestRule) == "true"; | 445 kAnswersInSuggestRule) == "true"; |
| 446 } | 446 } |
| 447 | 447 |
| 448 bool OmniboxFieldTrial::AddUWYTMatchEvenIfPromotedURLs() { |
| 449 return chrome_variations::GetVariationParamValue( |
| 450 kBundledExperimentFieldTrialName, |
| 451 kAddUWYTMatchEvenIfPromotedURLsRule) == "true"; |
| 452 } |
| 453 |
| 448 const char OmniboxFieldTrial::kBundledExperimentFieldTrialName[] = | 454 const char OmniboxFieldTrial::kBundledExperimentFieldTrialName[] = |
| 449 "OmniboxBundledExperimentV1"; | 455 "OmniboxBundledExperimentV1"; |
| 450 const char OmniboxFieldTrial::kShortcutsScoringMaxRelevanceRule[] = | 456 const char OmniboxFieldTrial::kShortcutsScoringMaxRelevanceRule[] = |
| 451 "ShortcutsScoringMaxRelevance"; | 457 "ShortcutsScoringMaxRelevance"; |
| 452 const char OmniboxFieldTrial::kSearchHistoryRule[] = "SearchHistory"; | 458 const char OmniboxFieldTrial::kSearchHistoryRule[] = "SearchHistory"; |
| 453 const char OmniboxFieldTrial::kDemoteByTypeRule[] = "DemoteByType"; | 459 const char OmniboxFieldTrial::kDemoteByTypeRule[] = "DemoteByType"; |
| 454 const char OmniboxFieldTrial::kHQPBookmarkValueRule[] = | 460 const char OmniboxFieldTrial::kHQPBookmarkValueRule[] = |
| 455 "HQPBookmarkValue"; | 461 "HQPBookmarkValue"; |
| 456 const char OmniboxFieldTrial::kHQPAllowMatchInTLDRule[] = "HQPAllowMatchInTLD"; | 462 const char OmniboxFieldTrial::kHQPAllowMatchInTLDRule[] = "HQPAllowMatchInTLD"; |
| 457 const char OmniboxFieldTrial::kHQPAllowMatchInSchemeRule[] = | 463 const char OmniboxFieldTrial::kHQPAllowMatchInSchemeRule[] = |
| 458 "HQPAllowMatchInScheme"; | 464 "HQPAllowMatchInScheme"; |
| 459 const char OmniboxFieldTrial::kZeroSuggestRule[] = "ZeroSuggest"; | 465 const char OmniboxFieldTrial::kZeroSuggestRule[] = "ZeroSuggest"; |
| 460 const char OmniboxFieldTrial::kZeroSuggestVariantRule[] = "ZeroSuggestVariant"; | 466 const char OmniboxFieldTrial::kZeroSuggestVariantRule[] = "ZeroSuggestVariant"; |
| 461 const char OmniboxFieldTrial::kBookmarksIndexURLsRule[] = "BookmarksIndexURLs"; | 467 const char OmniboxFieldTrial::kBookmarksIndexURLsRule[] = "BookmarksIndexURLs"; |
| 462 const char OmniboxFieldTrial::kDisableInliningRule[] = "DisableInlining"; | 468 const char OmniboxFieldTrial::kDisableInliningRule[] = "DisableInlining"; |
| 463 const char OmniboxFieldTrial::kAnswersInSuggestRule[] = "AnswersInSuggest"; | 469 const char OmniboxFieldTrial::kAnswersInSuggestRule[] = "AnswersInSuggest"; |
| 470 const char OmniboxFieldTrial::kAddUWYTMatchEvenIfPromotedURLsRule[] = |
| 471 "AddUWYTMatchEvenIfPromotedURLs"; |
| 464 | 472 |
| 465 const char OmniboxFieldTrial::kHUPNewScoringEnabledParam[] = | 473 const char OmniboxFieldTrial::kHUPNewScoringEnabledParam[] = |
| 466 "HUPExperimentalScoringEnabled"; | 474 "HUPExperimentalScoringEnabled"; |
| 467 const char OmniboxFieldTrial::kHUPNewScoringTypedCountRelevanceCapParam[] = | 475 const char OmniboxFieldTrial::kHUPNewScoringTypedCountRelevanceCapParam[] = |
| 468 "TypedCountRelevanceCap"; | 476 "TypedCountRelevanceCap"; |
| 469 const char OmniboxFieldTrial::kHUPNewScoringTypedCountHalfLifeTimeParam[] = | 477 const char OmniboxFieldTrial::kHUPNewScoringTypedCountHalfLifeTimeParam[] = |
| 470 "TypedCountHalfLifeTime"; | 478 "TypedCountHalfLifeTime"; |
| 471 const char OmniboxFieldTrial::kHUPNewScoringTypedCountScoreBucketsParam[] = | 479 const char OmniboxFieldTrial::kHUPNewScoringTypedCountScoreBucketsParam[] = |
| 472 "TypedCountScoreBuckets"; | 480 "TypedCountScoreBuckets"; |
| 473 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountRelevanceCapParam[] = | 481 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountRelevanceCapParam[] = |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 if (it != params.end()) | 540 if (it != params.end()) |
| 533 return it->second; | 541 return it->second; |
| 534 // Fall back to the global instant extended context. | 542 // Fall back to the global instant extended context. |
| 535 it = params.find(rule + ":" + page_classification_str + ":*"); | 543 it = params.find(rule + ":" + page_classification_str + ":*"); |
| 536 if (it != params.end()) | 544 if (it != params.end()) |
| 537 return it->second; | 545 return it->second; |
| 538 // Look up rule in the global context. | 546 // Look up rule in the global context. |
| 539 it = params.find(rule + ":*:*"); | 547 it = params.find(rule + ":*:*"); |
| 540 return (it != params.end()) ? it->second : std::string(); | 548 return (it != params.end()) ? it->second : std::string(); |
| 541 } | 549 } |
| OLD | NEW |