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

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

Issue 1908443003: Set site engagement timestamps to privacy-respectful values when history is cleared. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
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
« no previous file with comments | « no previous file | chrome/browser/engagement/site_engagement_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6fe0ac3076af114ad833e45f7e0835c5c17e96ab 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|. Otherwise, last
+ // 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
+ // 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. See crbug.com/604305
+ void Reset(double points, const base::Time* updated_time);
// Returns true if the maximum number of points today has been added.
bool MaxPointsPerDayAdded() const;
@@ -298,10 +310,18 @@ class SiteEngagementService : public KeyedService,
int OriginsWithMaxDailyEngagement() const;
int OriginsWithMaxEngagement(const std::map<GURL, double>& score_map) const;
- void GetCountsForOriginsComplete(
+ void GetCountsAndLastVisitForOriginsComplete(
+ history::HistoryService* history_service,
const std::multiset<GURL>& deleted_url_origins,
bool expired,
- const history::OriginCountMap& remaining_origin_counts);
+ const history::OriginCountAndLastVisitMap& 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_;
« no previous file with comments | « no previous file | chrome/browser/engagement/site_engagement_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698