| 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 #ifndef COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ | 5 #ifndef COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ |
| 6 #define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ | 6 #define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // A set of parameters describing how to cap a given count score. First, | 26 // A set of parameters describing how to cap a given count score. First, |
| 27 // we apply a half-life based decay of the given count and then find the | 27 // we apply a half-life based decay of the given count and then find the |
| 28 // maximum relevance score based on the decay factor or counts specified | 28 // maximum relevance score based on the decay factor or counts specified |
| 29 // in the corresponding bucket list. See comment on |buckets_| for details. | 29 // in the corresponding bucket list. See comment on |buckets_| for details. |
| 30 class ScoreBuckets { | 30 class ScoreBuckets { |
| 31 public: | 31 public: |
| 32 // Stores the max relevance at each count/decay factor threshold. | 32 // Stores the max relevance at each count/decay factor threshold. |
| 33 typedef std::pair<double, int> CountMaxRelevance; | 33 typedef std::pair<double, int> CountMaxRelevance; |
| 34 | 34 |
| 35 ScoreBuckets(); | 35 ScoreBuckets(); |
| 36 ScoreBuckets(const ScoreBuckets& other); |
| 36 ~ScoreBuckets(); | 37 ~ScoreBuckets(); |
| 37 | 38 |
| 38 // Computes a half-life time decay given the |elapsed_time|. | 39 // Computes a half-life time decay given the |elapsed_time|. |
| 39 double HalfLifeTimeDecay(const base::TimeDelta& elapsed_time) const; | 40 double HalfLifeTimeDecay(const base::TimeDelta& elapsed_time) const; |
| 40 | 41 |
| 41 int relevance_cap() const { return relevance_cap_; } | 42 int relevance_cap() const { return relevance_cap_; } |
| 42 void set_relevance_cap(int relevance_cap) { | 43 void set_relevance_cap(int relevance_cap) { |
| 43 relevance_cap_ = relevance_cap; | 44 relevance_cap_ = relevance_cap; |
| 44 } | 45 } |
| 45 | 46 |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 // prioritize different wildcard contexts, see the implementation. How to | 448 // prioritize different wildcard contexts, see the implementation. How to |
| 448 // interpret the value is left to the caller; this is rule-dependent. | 449 // interpret the value is left to the caller; this is rule-dependent. |
| 449 static std::string GetValueForRuleInContext( | 450 static std::string GetValueForRuleInContext( |
| 450 const std::string& rule, | 451 const std::string& rule, |
| 451 metrics::OmniboxEventProto::PageClassification page_classification); | 452 metrics::OmniboxEventProto::PageClassification page_classification); |
| 452 | 453 |
| 453 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); | 454 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); |
| 454 }; | 455 }; |
| 455 | 456 |
| 456 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ | 457 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ |
| OLD | NEW |