| 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/browser/omnibox_field_trial.h" | 5 #include "components/omnibox/browser/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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 return 10; | 427 return 10; |
| 428 return num_title_words; | 428 return num_title_words; |
| 429 } | 429 } |
| 430 | 430 |
| 431 bool OmniboxFieldTrial::HQPAlsoDoHUPLikeScoring() { | 431 bool OmniboxFieldTrial::HQPAlsoDoHUPLikeScoring() { |
| 432 return variations::GetVariationParamValue( | 432 return variations::GetVariationParamValue( |
| 433 kBundledExperimentFieldTrialName, | 433 kBundledExperimentFieldTrialName, |
| 434 kHQPAlsoDoHUPLikeScoringRule) == "true"; | 434 kHQPAlsoDoHUPLikeScoringRule) == "true"; |
| 435 } | 435 } |
| 436 | 436 |
| 437 bool OmniboxFieldTrial::HUPSearchDatabase() { |
| 438 const std::string& value = variations::GetVariationParamValue( |
| 439 kBundledExperimentFieldTrialName, |
| 440 kHUPSearchDatabaseRule); |
| 441 return value.empty() || (value == "true"); |
| 442 } |
| 443 |
| 437 bool OmniboxFieldTrial::PreventUWYTDefaultForNonURLInputs() { | 444 bool OmniboxFieldTrial::PreventUWYTDefaultForNonURLInputs() { |
| 438 return variations::GetVariationParamValue( | 445 return variations::GetVariationParamValue( |
| 439 kBundledExperimentFieldTrialName, | 446 kBundledExperimentFieldTrialName, |
| 440 kPreventUWYTDefaultForNonURLInputsRule) == "true"; | 447 kPreventUWYTDefaultForNonURLInputsRule) == "true"; |
| 441 } | 448 } |
| 442 | 449 |
| 443 bool OmniboxFieldTrial::KeywordRequiresRegistry() { | 450 bool OmniboxFieldTrial::KeywordRequiresRegistry() { |
| 444 const std::string& value = variations::GetVariationParamValue( | 451 const std::string& value = variations::GetVariationParamValue( |
| 445 kBundledExperimentFieldTrialName, | 452 kBundledExperimentFieldTrialName, |
| 446 kKeywordRequiresRegistryRule); | 453 kKeywordRequiresRegistryRule); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 const char | 496 const char |
| 490 OmniboxFieldTrial::kMeasureSuggestPollingDelayFromLastKeystrokeRule[] = | 497 OmniboxFieldTrial::kMeasureSuggestPollingDelayFromLastKeystrokeRule[] = |
| 491 "MeasureSuggestPollingDelayFromLastKeystroke"; | 498 "MeasureSuggestPollingDelayFromLastKeystroke"; |
| 492 const char OmniboxFieldTrial::kSuggestPollingDelayMsRule[] = | 499 const char OmniboxFieldTrial::kSuggestPollingDelayMsRule[] = |
| 493 "SuggestPollingDelayMs"; | 500 "SuggestPollingDelayMs"; |
| 494 const char OmniboxFieldTrial::kHQPFixFrequencyScoringBugsRule[] = | 501 const char OmniboxFieldTrial::kHQPFixFrequencyScoringBugsRule[] = |
| 495 "HQPFixFrequencyScoringBugs"; | 502 "HQPFixFrequencyScoringBugs"; |
| 496 const char OmniboxFieldTrial::kHQPNumTitleWordsRule[] = "HQPNumTitleWords"; | 503 const char OmniboxFieldTrial::kHQPNumTitleWordsRule[] = "HQPNumTitleWords"; |
| 497 const char OmniboxFieldTrial::kHQPAlsoDoHUPLikeScoringRule[] = | 504 const char OmniboxFieldTrial::kHQPAlsoDoHUPLikeScoringRule[] = |
| 498 "HQPAlsoDoHUPLikeScoring"; | 505 "HQPAlsoDoHUPLikeScoring"; |
| 506 const char OmniboxFieldTrial::kHUPSearchDatabaseRule[] = |
| 507 "HUPSearchDatabase"; |
| 499 const char OmniboxFieldTrial::kPreventUWYTDefaultForNonURLInputsRule[] = | 508 const char OmniboxFieldTrial::kPreventUWYTDefaultForNonURLInputsRule[] = |
| 500 "PreventUWYTDefaultForNonURLInputs"; | 509 "PreventUWYTDefaultForNonURLInputs"; |
| 501 const char OmniboxFieldTrial::kKeywordRequiresRegistryRule[] = | 510 const char OmniboxFieldTrial::kKeywordRequiresRegistryRule[] = |
| 502 "KeywordRequiresRegistry"; | 511 "KeywordRequiresRegistry"; |
| 503 const char OmniboxFieldTrial::kKeywordRequiresPrefixMatchRule[] = | 512 const char OmniboxFieldTrial::kKeywordRequiresPrefixMatchRule[] = |
| 504 "KeywordRequiresPrefixMatch"; | 513 "KeywordRequiresPrefixMatch"; |
| 505 const char OmniboxFieldTrial::kKeywordScoreForSufficientlyCompleteMatchRule[] = | 514 const char OmniboxFieldTrial::kKeywordScoreForSufficientlyCompleteMatchRule[] = |
| 506 "KeywordScoreForSufficientlyCompleteMatch"; | 515 "KeywordScoreForSufficientlyCompleteMatch"; |
| 507 | 516 |
| 508 const char OmniboxFieldTrial::kHUPNewScoringEnabledParam[] = | 517 const char OmniboxFieldTrial::kHUPNewScoringEnabledParam[] = |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 if (it != params.end()) | 599 if (it != params.end()) |
| 591 return it->second; | 600 return it->second; |
| 592 // Fall back to the global instant extended context. | 601 // Fall back to the global instant extended context. |
| 593 it = params.find(rule + ":" + page_classification_str + ":*"); | 602 it = params.find(rule + ":" + page_classification_str + ":*"); |
| 594 if (it != params.end()) | 603 if (it != params.end()) |
| 595 return it->second; | 604 return it->second; |
| 596 // Look up rule in the global context. | 605 // Look up rule in the global context. |
| 597 it = params.find(rule + ":*:*"); | 606 it = params.find(rule + ":*:*"); |
| 598 return (it != params.end()) ? it->second : std::string(); | 607 return (it != params.end()) ? it->second : std::string(); |
| 599 } | 608 } |
| OLD | NEW |