| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace | 88 } // namespace |
| 89 | 89 |
| 90 HUPScoringParams::ScoreBuckets::ScoreBuckets() | 90 HUPScoringParams::ScoreBuckets::ScoreBuckets() |
| 91 : relevance_cap_(-1), | 91 : relevance_cap_(-1), |
| 92 half_life_days_(-1), | 92 half_life_days_(-1), |
| 93 use_decay_factor_(false) { | 93 use_decay_factor_(false) { |
| 94 } | 94 } |
| 95 | 95 |
| 96 HUPScoringParams::ScoreBuckets::ScoreBuckets(const ScoreBuckets& other) = |
| 97 default; |
| 98 |
| 96 HUPScoringParams::ScoreBuckets::~ScoreBuckets() { | 99 HUPScoringParams::ScoreBuckets::~ScoreBuckets() { |
| 97 } | 100 } |
| 98 | 101 |
| 99 double HUPScoringParams::ScoreBuckets::HalfLifeTimeDecay( | 102 double HUPScoringParams::ScoreBuckets::HalfLifeTimeDecay( |
| 100 const base::TimeDelta& elapsed_time) const { | 103 const base::TimeDelta& elapsed_time) const { |
| 101 double time_ms; | 104 double time_ms; |
| 102 if ((half_life_days_ <= 0) || | 105 if ((half_life_days_ <= 0) || |
| 103 ((time_ms = elapsed_time.InMillisecondsF()) <= 0)) | 106 ((time_ms = elapsed_time.InMillisecondsF()) <= 0)) |
| 104 return 1.0; | 107 return 1.0; |
| 105 | 108 |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 if (it != params.end()) | 616 if (it != params.end()) |
| 614 return it->second; | 617 return it->second; |
| 615 // Fall back to the global instant extended context. | 618 // Fall back to the global instant extended context. |
| 616 it = params.find(rule + ":" + page_classification_str + ":*"); | 619 it = params.find(rule + ":" + page_classification_str + ":*"); |
| 617 if (it != params.end()) | 620 if (it != params.end()) |
| 618 return it->second; | 621 return it->second; |
| 619 // Look up rule in the global context. | 622 // Look up rule in the global context. |
| 620 it = params.find(rule + ":*:*"); | 623 it = params.find(rule + ":*:*"); |
| 621 return (it != params.end()) ? it->second : std::string(); | 624 return (it != params.end()) ? it->second : std::string(); |
| 622 } | 625 } |
| OLD | NEW |