| 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 const std::string& polling_delay_string = variations::GetVariationParamValue( | 364 const std::string& polling_delay_string = variations::GetVariationParamValue( |
| 365 kBundledExperimentFieldTrialName, | 365 kBundledExperimentFieldTrialName, |
| 366 kSuggestPollingDelayMsRule); | 366 kSuggestPollingDelayMsRule); |
| 367 if (polling_delay_string.empty() || | 367 if (polling_delay_string.empty() || |
| 368 !base::StringToInt(polling_delay_string, polling_delay_ms) || | 368 !base::StringToInt(polling_delay_string, polling_delay_ms) || |
| 369 (*polling_delay_ms <= 0)) { | 369 (*polling_delay_ms <= 0)) { |
| 370 *polling_delay_ms = kDefaultMinimumTimeBetweenSuggestQueriesMs; | 370 *polling_delay_ms = kDefaultMinimumTimeBetweenSuggestQueriesMs; |
| 371 } | 371 } |
| 372 } | 372 } |
| 373 | 373 |
| 374 bool OmniboxFieldTrial::HQPExperimentalScoringEnabled() { | |
| 375 return variations::GetVariationParamValue( | |
| 376 kBundledExperimentFieldTrialName, | |
| 377 kHQPExperimentalScoringEnabledParam) == "true"; | |
| 378 } | |
| 379 | |
| 380 std::string OmniboxFieldTrial::HQPExperimentalScoringBuckets() { | 374 std::string OmniboxFieldTrial::HQPExperimentalScoringBuckets() { |
| 381 if (!HQPExperimentalScoringEnabled()) | |
| 382 return ""; | |
| 383 | |
| 384 return variations::GetVariationParamValue( | 375 return variations::GetVariationParamValue( |
| 385 kBundledExperimentFieldTrialName, | 376 kBundledExperimentFieldTrialName, |
| 386 kHQPExperimentalScoringBucketsParam); | 377 kHQPExperimentalScoringBucketsParam); |
| 387 } | 378 } |
| 388 | 379 |
| 389 float OmniboxFieldTrial::HQPExperimentalTopicalityThreshold() { | 380 float OmniboxFieldTrial::HQPExperimentalTopicalityThreshold() { |
| 390 if (!HQPExperimentalScoringEnabled()) | 381 std::string topicality_threshold_str = variations::GetVariationParamValue( |
| 391 return -1; | 382 kBundledExperimentFieldTrialName, |
| 392 | 383 kHQPExperimentalScoringTopicalityThresholdParam); |
| 393 std::string topicality_threhold_str = | |
| 394 variations::GetVariationParamValue( | |
| 395 kBundledExperimentFieldTrialName, | |
| 396 kHQPExperimentalScoringTopicalityThresholdParam); | |
| 397 | 384 |
| 398 double topicality_threshold; | 385 double topicality_threshold; |
| 399 if (!base::StringToDouble(topicality_threhold_str, &topicality_threshold)) | 386 if (topicality_threshold_str.empty() || |
| 400 return -1; | 387 !base::StringToDouble(topicality_threshold_str, &topicality_threshold)) |
| 388 return 0.8f; |
| 401 | 389 |
| 402 return static_cast<float>(topicality_threshold); | 390 return static_cast<float>(topicality_threshold); |
| 403 } | 391 } |
| 404 | 392 |
| 405 bool OmniboxFieldTrial::HQPFixFewVisitsBug() { | 393 bool OmniboxFieldTrial::HQPFixFewVisitsBug() { |
| 406 return variations::GetVariationParamValue( | 394 return variations::GetVariationParamValue( |
| 407 kBundledExperimentFieldTrialName, | 395 kBundledExperimentFieldTrialName, |
| 408 kHQPFixFewVisitsBugRule) == "true"; | 396 kHQPFixFewVisitsBugRule) == "true"; |
| 409 } | 397 } |
| 410 | 398 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 "TypedCountUseDecayFactor"; | 561 "TypedCountUseDecayFactor"; |
| 574 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountRelevanceCapParam[] = | 562 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountRelevanceCapParam[] = |
| 575 "VisitedCountRelevanceCap"; | 563 "VisitedCountRelevanceCap"; |
| 576 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountHalfLifeTimeParam[] = | 564 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountHalfLifeTimeParam[] = |
| 577 "VisitedCountHalfLifeTime"; | 565 "VisitedCountHalfLifeTime"; |
| 578 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountScoreBucketsParam[] = | 566 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountScoreBucketsParam[] = |
| 579 "VisitedCountScoreBuckets"; | 567 "VisitedCountScoreBuckets"; |
| 580 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountUseDecayFactorParam[] = | 568 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountUseDecayFactorParam[] = |
| 581 "VisitedCountUseDecayFactor"; | 569 "VisitedCountUseDecayFactor"; |
| 582 | 570 |
| 583 const char OmniboxFieldTrial::kHQPExperimentalScoringEnabledParam[] = | |
| 584 "HQPExperimentalScoringEnabled"; | |
| 585 const char OmniboxFieldTrial::kHQPExperimentalScoringBucketsParam[] = | 571 const char OmniboxFieldTrial::kHQPExperimentalScoringBucketsParam[] = |
| 586 "HQPExperimentalScoringBuckets"; | 572 "HQPExperimentalScoringBuckets"; |
| 587 const char | 573 const char |
| 588 OmniboxFieldTrial::kHQPExperimentalScoringTopicalityThresholdParam[] = | 574 OmniboxFieldTrial::kHQPExperimentalScoringTopicalityThresholdParam[] = |
| 589 "HQPExperimentalScoringTopicalityThreshold"; | 575 "HQPExperimentalScoringTopicalityThreshold"; |
| 590 | 576 |
| 591 // static | 577 // static |
| 592 int OmniboxFieldTrial::kDefaultMinimumTimeBetweenSuggestQueriesMs = 100; | 578 int OmniboxFieldTrial::kDefaultMinimumTimeBetweenSuggestQueriesMs = 100; |
| 593 | 579 |
| 594 // Background and implementation details: | 580 // Background and implementation details: |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 if (it != params.end()) | 632 if (it != params.end()) |
| 647 return it->second; | 633 return it->second; |
| 648 // Fall back to the global instant extended context. | 634 // Fall back to the global instant extended context. |
| 649 it = params.find(rule + ":" + page_classification_str + ":*"); | 635 it = params.find(rule + ":" + page_classification_str + ":*"); |
| 650 if (it != params.end()) | 636 if (it != params.end()) |
| 651 return it->second; | 637 return it->second; |
| 652 // Look up rule in the global context. | 638 // Look up rule in the global context. |
| 653 it = params.find(rule + ":*:*"); | 639 it = params.find(rule + ":*:*"); |
| 654 return (it != params.end()) ? it->second : std::string(); | 640 return (it != params.end()) ? it->second : std::string(); |
| 655 } | 641 } |
| OLD | NEW |