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