Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4403)

Unified Diff: chrome/browser/engagement/site_engagement_service.h

Issue 1901563002: Set site engagement timestamps to privacy-respectful values when history is cleared. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/engagement/site_engagement_service.h
diff --git a/chrome/browser/engagement/site_engagement_service.h b/chrome/browser/engagement/site_engagement_service.h
index 4cfdc78a6f7d6891be8c25f2a1993f5be06fe73c..6e98186b21f561f644037dbecdbc91f636a8d68b 100644
--- a/chrome/browser/engagement/site_engagement_service.h
+++ b/chrome/browser/engagement/site_engagement_service.h
@@ -22,6 +22,10 @@ class DictionaryValue;
class Clock;
}
+namespace history {
+class HistoryService;
+}
+
class GURL;
class Profile;
@@ -101,8 +105,16 @@ class SiteEngagementScore {
double Score() const;
void AddPoints(double points);
- // Resets the score to |points| and reset the daily point limit.
- void Reset(double points);
+ // 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|. Othewise, last
benwells 2016/04/18 07:01:42 Typo in Othewise.
dominickn 2016/04/18 23:27:52 Done.
+ // engagement time is set to the current time and last shortcut launch time is
+ // left unchanged.
+ // TODO(calamity): Ideally, all SiteEngagementScore methods should take a
benwells 2016/04/18 07:01:42 Could you file a bug and refer to it here?
dominickn 2016/04/18 23:27:52 Done.
+ // base::Time argument like this one does rather than each Score hold a
+ // pointer to a base::Clock. Then SiteEngagementScore doesn't need to worry
+ // about clock vending - it's always told what time to use.
+ void Reset(double points, const base::Time* updated_time);
// Returns true if the maximum number of points today has been added.
bool MaxPointsPerDayAdded() const;
@@ -299,10 +311,18 @@ class SiteEngagementService : public KeyedService,
int OriginsWithMaxEngagement(const std::map<GURL, double>& score_map) const;
void GetCountsForOriginsComplete(
+ history::HistoryService* history_service,
const std::multiset<GURL>& deleted_url_origins,
bool expired,
const history::OriginCountMap& remaining_origin_counts);
+ // Resets the engagement score for |url| to |score|, and sets the last
+ // engagement time and last shortcut launch time (if it is non-null) to
+ // |updated_time|. Clears daily limits.
+ void ResetScoreAndAccessTimesForURL(const GURL& url,
+ double score,
+ const base::Time* updated_time);
+
Profile* profile_;
// The clock used to vend times.

Powered by Google App Engine
This is Rietveld 408576698