Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_NTP_SNIPPETS_USER_CLASSIFIER_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_USER_CLASSIFIER_H_ |
| 6 #define COMPONENTS_NTP_SNIPPETS_USER_CLASSIFIER_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_USER_CLASSIFIER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 // Informs the UserClassifier about a new event for |metric|. The | 59 // Informs the UserClassifier about a new event for |metric|. The |
| 60 // classification is based on these calls. | 60 // classification is based on these calls. |
| 61 void OnEvent(Metric metric); | 61 void OnEvent(Metric metric); |
| 62 | 62 |
| 63 // Get the estimate average length of the interval between two successive | 63 // Get the estimate average length of the interval between two successive |
| 64 // events of the given type. | 64 // events of the given type. |
| 65 double GetEstimatedAvgTime(Metric metric) const; | 65 double GetEstimatedAvgTime(Metric metric) const; |
| 66 | 66 |
| 67 // Return the classification of the current user. | 67 // Return the classification of the current user. |
| 68 UserClass GetUserClass() const; | 68 UserClass GetUserClass() const; |
| 69 std::string GetUserClassNameForProto() const; | |
|
Marc Treib
2016/10/06 13:41:55
What does this have to do with protobufs?
Should t
jkrcal
2016/10/06 14:45:58
Makes sense. Done.
| |
| 69 std::string GetUserClassDescriptionForDebugging() const; | 70 std::string GetUserClassDescriptionForDebugging() const; |
| 70 | 71 |
| 71 // Resets the classification (emulates a fresh upgrade / install). | 72 // Resets the classification (emulates a fresh upgrade / install). |
| 72 void ClearClassificationForDebugging(); | 73 void ClearClassificationForDebugging(); |
| 73 | 74 |
| 74 private: | 75 private: |
| 75 // The event has happened, recompute the metric accordingly. Then store and | 76 // The event has happened, recompute the metric accordingly. Then store and |
| 76 // return the new value. | 77 // return the new value. |
| 77 double UpdateMetricOnEvent(Metric metric); | 78 double UpdateMetricOnEvent(Metric metric); |
| 78 // No event has happened but we need to get up-to-date metric, recompute and | 79 // No event has happened but we need to get up-to-date metric, recompute and |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 100 // Params of the classification. | 101 // Params of the classification. |
| 101 const double active_consumer_scrolls_at_least_once_per_hours_; | 102 const double active_consumer_scrolls_at_least_once_per_hours_; |
| 102 const double rare_user_opens_ntp_at_most_once_per_hours_; | 103 const double rare_user_opens_ntp_at_most_once_per_hours_; |
| 103 | 104 |
| 104 DISALLOW_COPY_AND_ASSIGN(UserClassifier); | 105 DISALLOW_COPY_AND_ASSIGN(UserClassifier); |
| 105 }; | 106 }; |
| 106 | 107 |
| 107 } // namespace ntp_snippets | 108 } // namespace ntp_snippets |
| 108 | 109 |
| 109 #endif // COMPONENTS_NTP_SNIPPETS_USER_CLASSIFIER_H_ | 110 #endif // COMPONENTS_NTP_SNIPPETS_USER_CLASSIFIER_H_ |
| OLD | NEW |