| 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 kBundledExperimentFieldTrialName, | 394 kBundledExperimentFieldTrialName, |
| 395 kHQPExperimentalScoringTopicalityThresholdParam); | 395 kHQPExperimentalScoringTopicalityThresholdParam); |
| 396 | 396 |
| 397 double topicality_threshold; | 397 double topicality_threshold; |
| 398 if (!base::StringToDouble(topicality_threhold_str, &topicality_threshold)) | 398 if (!base::StringToDouble(topicality_threhold_str, &topicality_threshold)) |
| 399 return -1; | 399 return -1; |
| 400 | 400 |
| 401 return static_cast<float>(topicality_threshold); | 401 return static_cast<float>(topicality_threshold); |
| 402 } | 402 } |
| 403 | 403 |
| 404 bool OmniboxFieldTrial::HQPFixTypedVisitBug() { | |
| 405 return variations::GetVariationParamValue( | |
| 406 kBundledExperimentFieldTrialName, | |
| 407 kHQPFixTypedVisitBugRule) == "true"; | |
| 408 } | |
| 409 | |
| 410 bool OmniboxFieldTrial::HQPFixFewVisitsBug() { | 404 bool OmniboxFieldTrial::HQPFixFewVisitsBug() { |
| 411 return variations::GetVariationParamValue( | 405 return variations::GetVariationParamValue( |
| 412 kBundledExperimentFieldTrialName, | 406 kBundledExperimentFieldTrialName, |
| 413 kHQPFixFewVisitsBugRule) == "true"; | 407 kHQPFixFewVisitsBugRule) == "true"; |
| 414 } | 408 } |
| 415 | 409 |
| 416 size_t OmniboxFieldTrial::HQPNumTitleWordsToAllow() { | 410 size_t OmniboxFieldTrial::HQPNumTitleWordsToAllow() { |
| 417 // The value of the rule is a string that encodes an integer (actually | 411 // The value of the rule is a string that encodes an integer (actually |
| 418 // size_t) containing the number of words. | 412 // size_t) containing the number of words. |
| 419 size_t num_title_words; | 413 size_t num_title_words; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 const char OmniboxFieldTrial::kZeroSuggestRule[] = "ZeroSuggest"; | 506 const char OmniboxFieldTrial::kZeroSuggestRule[] = "ZeroSuggest"; |
| 513 const char OmniboxFieldTrial::kZeroSuggestVariantRule[] = "ZeroSuggestVariant"; | 507 const char OmniboxFieldTrial::kZeroSuggestVariantRule[] = "ZeroSuggestVariant"; |
| 514 const char OmniboxFieldTrial::kSuggestVariantRule[] = "SuggestVariant"; | 508 const char OmniboxFieldTrial::kSuggestVariantRule[] = "SuggestVariant"; |
| 515 const char OmniboxFieldTrial::kDisableResultsCachingRule[] = | 509 const char OmniboxFieldTrial::kDisableResultsCachingRule[] = |
| 516 "DisableResultsCaching"; | 510 "DisableResultsCaching"; |
| 517 const char | 511 const char |
| 518 OmniboxFieldTrial::kMeasureSuggestPollingDelayFromLastKeystrokeRule[] = | 512 OmniboxFieldTrial::kMeasureSuggestPollingDelayFromLastKeystrokeRule[] = |
| 519 "MeasureSuggestPollingDelayFromLastKeystroke"; | 513 "MeasureSuggestPollingDelayFromLastKeystroke"; |
| 520 const char OmniboxFieldTrial::kSuggestPollingDelayMsRule[] = | 514 const char OmniboxFieldTrial::kSuggestPollingDelayMsRule[] = |
| 521 "SuggestPollingDelayMs"; | 515 "SuggestPollingDelayMs"; |
| 522 const char OmniboxFieldTrial::kHQPFixTypedVisitBugRule[] = | |
| 523 "HQPFixTypedVisitBug"; | |
| 524 const char OmniboxFieldTrial::kHQPFixFewVisitsBugRule[] = "HQPFixFewVisitsBug"; | 516 const char OmniboxFieldTrial::kHQPFixFewVisitsBugRule[] = "HQPFixFewVisitsBug"; |
| 525 const char OmniboxFieldTrial::kHQPNumTitleWordsRule[] = "HQPNumTitleWords"; | 517 const char OmniboxFieldTrial::kHQPNumTitleWordsRule[] = "HQPNumTitleWords"; |
| 526 const char OmniboxFieldTrial::kHQPAlsoDoHUPLikeScoringRule[] = | 518 const char OmniboxFieldTrial::kHQPAlsoDoHUPLikeScoringRule[] = |
| 527 "HQPAlsoDoHUPLikeScoring"; | 519 "HQPAlsoDoHUPLikeScoring"; |
| 528 const char OmniboxFieldTrial::kHUPSearchDatabaseRule[] = | 520 const char OmniboxFieldTrial::kHUPSearchDatabaseRule[] = |
| 529 "HUPSearchDatabase"; | 521 "HUPSearchDatabase"; |
| 530 const char OmniboxFieldTrial::kKeywordRequiresRegistryRule[] = | 522 const char OmniboxFieldTrial::kKeywordRequiresRegistryRule[] = |
| 531 "KeywordRequiresRegistry"; | 523 "KeywordRequiresRegistry"; |
| 532 const char OmniboxFieldTrial::kKeywordRequiresPrefixMatchRule[] = | 524 const char OmniboxFieldTrial::kKeywordRequiresPrefixMatchRule[] = |
| 533 "KeywordRequiresPrefixMatch"; | 525 "KeywordRequiresPrefixMatch"; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 if (it != params.end()) | 614 if (it != params.end()) |
| 623 return it->second; | 615 return it->second; |
| 624 // Fall back to the global instant extended context. | 616 // Fall back to the global instant extended context. |
| 625 it = params.find(rule + ":" + page_classification_str + ":*"); | 617 it = params.find(rule + ":" + page_classification_str + ":*"); |
| 626 if (it != params.end()) | 618 if (it != params.end()) |
| 627 return it->second; | 619 return it->second; |
| 628 // Look up rule in the global context. | 620 // Look up rule in the global context. |
| 629 it = params.find(rule + ":*:*"); | 621 it = params.find(rule + ":*:*"); |
| 630 return (it != params.end()) ? it->second : std::string(); | 622 return (it != params.end()) ? it->second : std::string(); |
| 631 } | 623 } |
| OLD | NEW |