Index: chrome/browser/engagement/site_engagement_score.h |
diff --git a/chrome/browser/engagement/site_engagement_score.h b/chrome/browser/engagement/site_engagement_score.h |
index 33d4a3af5a6fa766fda50cae6071cfac608ce89e..a051f9c9b749757b31acc55613d944f4f83457df 100644 |
--- a/chrome/browser/engagement/site_engagement_score.h |
+++ b/chrome/browser/engagement/site_engagement_score.h |
@@ -63,6 +63,13 @@ class SiteEngagementScore { |
MEDIUM_ENGAGEMENT_BOUNDARY, |
HIGH_ENGAGEMENT_BOUNDARY, |
+ // If this many hours passes with no engagement of any kind, the next |
+ // points-adding event (or browser startup) will reset each score's last |
+ // engagement time to prevent decay when Chrome isn't in use. Times are set |
+ // to (now - (overall_last_engagement_time - score_last_engagement_time)). |
+ // This value MUST be at least one second greater than the decay period. |
+ OBSOLETE_LAST_ENGAGEMENT_PERIOD_IN_HOURS, |
calamity
2016/06/23 05:18:40
This name is weird. It makes it look like this is
dominickn
2016/06/27 02:53:34
Done.
|
+ |
MAX_VARIATION |
}; |
@@ -81,6 +88,7 @@ class SiteEngagementScore { |
static double GetBootstrapPoints(); |
static double GetMediumEngagementBoundary(); |
static double GetHighEngagementBoundary(); |
+ static double GetObsoleteLastEngagementPeriodInHours(); |
// Update the default engagement settings via variations. |
static void UpdateFromVariations(const char* param_name); |
@@ -109,10 +117,7 @@ class SiteEngagementScore { |
bool MaxPointsPerDayAdded() const; |
// Resets the score to |points| and resets the daily point limit. If |
- // |updated_time| is non-null, sets the last engagement time and last |
- // shortcut launch time (if it is non-null) to |updated_time|. Otherwise, last |
- // engagement time is set to the current time and last shortcut launch time is |
- // left unchanged. |
+ // |updated_time| is non-null, sets the last engagement time to that value. |
void Reset(double points, const base::Time updated_time); |
// Get/set the last time this origin was launched from an installed shortcut. |
@@ -123,6 +128,14 @@ class SiteEngagementScore { |
last_shortcut_launch_time_ = time; |
} |
+ // Get/set the last time this origin recorded an engagement change. |
+ base::Time last_engagement_time() const { |
+ return last_engagement_time_; |
+ } |
+ void set_last_engagement_time(const base::Time& time) { |
+ last_engagement_time_ = time; |
+ } |
+ |
private: |
FRIEND_TEST_ALL_PREFIXES(SiteEngagementScoreTest, PartiallyEmptyDictionary); |
FRIEND_TEST_ALL_PREFIXES(SiteEngagementScoreTest, PopulatedDictionary); |