| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ |
| 6 #define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ | 6 #define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 // This version of the constructor is used in unit tests. | 126 // This version of the constructor is used in unit tests. |
| 127 explicit SiteEngagementScore(base::Clock* clock); | 127 explicit SiteEngagementScore(base::Clock* clock); |
| 128 | 128 |
| 129 // Determine the score, accounting for any decay. | 129 // Determine the score, accounting for any decay. |
| 130 double DecayedScore() const; | 130 double DecayedScore() const; |
| 131 | 131 |
| 132 // Determine any score bonus from having installed shortcuts. | 132 // Determine any score bonus from having installed shortcuts. |
| 133 double BonusScore() const; | 133 double BonusScore() const; |
| 134 | 134 |
| 135 static void DisableFirstDailyEngagementBonusForTesting(); | 135 // Sets fixed parameter values for testing site engagement. Ensure that any |
| 136 // newly added parameters receive a fixed value here. |
| 137 static void SetParamValuesForTesting(); |
| 136 | 138 |
| 137 // The clock used to vend times. Enables time travelling in tests. Owned by | 139 // The clock used to vend times. Enables time travelling in tests. Owned by |
| 138 // the SiteEngagementService. | 140 // the SiteEngagementService. |
| 139 base::Clock* clock_; | 141 base::Clock* clock_; |
| 140 | 142 |
| 141 // |raw_score_| is the score before any decay is applied. | 143 // |raw_score_| is the score before any decay is applied. |
| 142 double raw_score_; | 144 double raw_score_; |
| 143 | 145 |
| 144 // The points added 'today' are tracked to avoid adding more than | 146 // The points added 'today' are tracked to avoid adding more than |
| 145 // kMaxPointsPerDay on any one day. 'Today' is defined in local time. | 147 // kMaxPointsPerDay on any one day. 'Today' is defined in local time. |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 // origin's engagement score after an hour has elapsed triggers the next | 275 // origin's engagement score after an hour has elapsed triggers the next |
| 274 // upload. | 276 // upload. |
| 275 base::Time last_metrics_time_; | 277 base::Time last_metrics_time_; |
| 276 | 278 |
| 277 base::WeakPtrFactory<SiteEngagementService> weak_factory_; | 279 base::WeakPtrFactory<SiteEngagementService> weak_factory_; |
| 278 | 280 |
| 279 DISALLOW_COPY_AND_ASSIGN(SiteEngagementService); | 281 DISALLOW_COPY_AND_ASSIGN(SiteEngagementService); |
| 280 }; | 282 }; |
| 281 | 283 |
| 282 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ | 284 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ |
| OLD | NEW |