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

Unified Diff: chrome/browser/notifications/platform_notification_service_impl.cc

Issue 2748103011: Grant origins engagement for having interactions on their notifications. (Closed)
Patch Set: Unfriend 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/notifications/platform_notification_service_impl.cc
diff --git a/chrome/browser/notifications/platform_notification_service_impl.cc b/chrome/browser/notifications/platform_notification_service_impl.cc
index 6c70a2ced43d75a2728f84068b6f68685dfc4d7c..293d3a541929b9e96fd6d34bdd7ef83d4b9036f2 100644
--- a/chrome/browser/notifications/platform_notification_service_impl.cc
+++ b/chrome/browser/notifications/platform_notification_service_impl.cc
@@ -13,6 +13,7 @@
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
+#include "chrome/browser/engagement/site_engagement_service.h"
#include "chrome/browser/notifications/notification_display_service_factory.h"
#include "chrome/browser/notifications/notification_object_proxy.h"
#include "chrome/browser/notifications/persistent_notification_delegate.h"
@@ -155,6 +156,7 @@ void PlatformNotificationServiceImpl::OnPersistentNotificationClick(
}
#endif
+ RecordSiteEngagement(browser_context, origin);
content::NotificationEventDispatcher::GetInstance()
->DispatchNotificationClickEvent(
browser_context, notification_id, origin, action_index, reply,
@@ -529,3 +531,13 @@ void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting(
NotificationDisplayService* display_service) {
test_display_service_ = display_service;
}
+
+void PlatformNotificationServiceImpl::RecordSiteEngagement(
+ BrowserContext* browser_context,
+ const GURL& origin) {
+ // TODO(dominickn, peter): This would be better if the site engagement service
+ // could directly observe each notification.
+ SiteEngagementService* engagement_service =
+ SiteEngagementService::Get(Profile::FromBrowserContext(browser_context));
+ engagement_service->HandleNotificationInteraction(origin);
+}

Powered by Google App Engine
This is Rietveld 408576698