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

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

Issue 2553013002: Expose the Site Engagement Service to Java. (Closed)
Patch Set: LocalRef to GlobalRef Created 4 years 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 65e22334d8f10e947e2d42a9d5624716a9a79459..350d30a934855a90f559122d691434087003c1fa 100644
--- a/chrome/browser/engagement/site_engagement_service.h
+++ b/chrome/browser/engagement/site_engagement_service.h
@@ -14,6 +14,7 @@
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/time/time.h"
+#include "build/build_config.h"
#include "chrome/browser/engagement/site_engagement_metrics.h"
#include "chrome/browser/engagement/site_engagement_observer.h"
#include "components/history/core/browser/history_service_observer.h"
@@ -37,6 +38,10 @@ class HostContentSettingsMap;
class Profile;
class SiteEngagementScore;
+#if defined(OS_ANDROID)
+class SiteEngagementServiceAndroid;
+#endif
+
class SiteEngagementScoreProvider {
public:
// Returns a non-negative integer representing the engagement score of the
@@ -134,6 +139,7 @@ class SiteEngagementService : public KeyedService,
private:
friend class SiteEngagementObserver;
+ friend class SiteEngagementServiceAndroid;
FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, CheckHistograms);
FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, CleanupEngagementScores);
FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest,
@@ -160,6 +166,13 @@ class SiteEngagementService : public KeyedService,
FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, GetScoreFromSettings);
FRIEND_TEST_ALL_PREFIXES(AppBannerSettingsHelperTest, SiteEngagementTrigger);
+#if defined(OS_ANDROID)
+ // Shim class to expose the service to Java.
+ SiteEngagementServiceAndroid* GetAndroidService() const;
+ void SetAndroidService(
+ std::unique_ptr<SiteEngagementServiceAndroid> android_service);
+#endif
+
// Only used in tests.
SiteEngagementService(Profile* profile, std::unique_ptr<base::Clock> clock);
@@ -253,6 +266,10 @@ class SiteEngagementService : public KeyedService,
// The clock used to vend times.
std::unique_ptr<base::Clock> clock_;
+#if defined(OS_ANDROID)
+ std::unique_ptr<SiteEngagementServiceAndroid> android_service_;
+#endif
+
// Metrics are recorded at non-incognito browser startup, and then
// approximately once per hour thereafter. Store the local time at which
// metrics were previously uploaded: the first event which affects any

Powered by Google App Engine
This is Rietveld 408576698