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

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

Issue 2748103011: Grant origins engagement for having interactions on their notifications. (Closed)
Patch Set: Created 3 years, 9 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.cc
diff --git a/chrome/browser/engagement/site_engagement_service.cc b/chrome/browser/engagement/site_engagement_service.cc
index edda88c4b38d468b73d20c7465cc203aec8c1342..132d9e1327800b20787220ff36866787e3621557 100644
--- a/chrome/browser/engagement/site_engagement_service.cc
+++ b/chrome/browser/engagement/site_engagement_service.cc
@@ -475,8 +475,9 @@ void SiteEngagementService::HandleMediaPlaying(
: SiteEngagementScore::GetVisibleMediaPoints());
RecordMetrics();
+ double score = GetScore(url);
for (SiteEngagementObserver& observer : observer_list_)
- observer.OnEngagementIncreased(web_contents, url, GetScore(url));
+ observer.OnEngagementIncreased(web_contents, url, score);
}
void SiteEngagementService::HandleNavigation(content::WebContents* web_contents,
@@ -490,8 +491,9 @@ void SiteEngagementService::HandleNavigation(content::WebContents* web_contents,
AddPoints(url, SiteEngagementScore::GetNavigationPoints());
RecordMetrics();
+ double score = GetScore(url);
for (SiteEngagementObserver& observer : observer_list_)
- observer.OnEngagementIncreased(web_contents, url, GetScore(url));
+ observer.OnEngagementIncreased(web_contents, url, score);
}
void SiteEngagementService::HandleUserInput(
@@ -505,8 +507,23 @@ void SiteEngagementService::HandleUserInput(
AddPoints(url, SiteEngagementScore::GetUserInputPoints());
RecordMetrics();
+ double score = GetScore(url);
+ for (SiteEngagementObserver& observer : observer_list_)
+ observer.OnEngagementIncreased(web_contents, url, score);
+}
+
+void SiteEngagementService::HandleNotificationInteraction(const GURL& url) {
+ if (!ShouldRecordEngagement(url))
+ return;
+
+ SiteEngagementMetrics::RecordEngagement(
+ SiteEngagementMetrics::ENGAGEMENT_NOTIFICATION_INTERACTION);
+ AddPoints(url, SiteEngagementScore::GetNotificationInteractionPoints());
+
+ RecordMetrics();
+ double score = GetScore(url);
for (SiteEngagementObserver& observer : observer_list_)
- observer.OnEngagementIncreased(web_contents, url, GetScore(url));
+ observer.OnEngagementIncreased(nullptr, url, score);
}
void SiteEngagementService::SendLevelChangeToHelpers(

Powered by Google App Engine
This is Rietveld 408576698