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

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

Issue 1368533004: Add UMA metrics to the site engagement service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@time-on-site
Patch Set: Adding tests, addressing reviewer feedback Created 5 years, 3 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 d2595180054f84897fc6cd4856edd518b8e2c6e2..953726c078d1d2037c8280fc9182b616ffb64ed4 100644
--- a/chrome/browser/engagement/site_engagement_service.h
+++ b/chrome/browser/engagement/site_engagement_service.h
@@ -10,6 +10,7 @@
#include "base/macros.h"
#include "base/time/default_clock.h"
#include "base/time/time.h"
+#include "chrome/browser/engagement/site_engagement_metrics.h"
#include "components/keyed_service/core/keyed_service.h"
#include "ui/base/page_transition_types.h"
@@ -56,6 +57,10 @@ class SiteEngagementScore {
double Score() const;
void AddPoints(double points);
+ // Returns true if the maximum number of points today has been added. Resets
+ // the number of points added today if the day has changed.
+ bool MaxPointsPerDayAdded();
+
// Updates the content settings dictionary |score_dict| with the current score
// fields. Returns true if |score_dict| changed, otherwise return false.
bool UpdateScoreDict(base::DictionaryValue* score_dict);
@@ -127,7 +132,8 @@ class SiteEngagementService : public KeyedService,
// Update the karma score of the origin matching |url| for time-on-site, based
// on user input.
- void HandleUserInput(const GURL& url);
+ void HandleUserInput(const GURL& url,
+ SiteEngagementMetrics::EngagementType type);
// Overridden from SiteEngagementScoreProvider:
double GetScore(const GURL& url) override;
@@ -138,6 +144,15 @@ class SiteEngagementService : public KeyedService,
// maximum limits for the day and overall.
void AddPoints(const GURL& url, double points);
+ // Returns the number of origins with maximum daily and total engagement
+ // respectively.
+ int OriginsWithMaxDailyEngagement();
+ int OriginsWithMaxEngagement();
+
+ // Logs the total number of origins stored by the site engagement service, and
+ // the total accumulated engagement score.
+ void RecordStartupUmaStats();
+
Profile* profile_;
// The clock used to vend times.

Powered by Google App Engine
This is Rietveld 408576698