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

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

Issue 1975723002: Reduce the site engagement service public interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Push messaging now uses engagement Created 4 years, 7 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_helper.h
diff --git a/chrome/browser/engagement/site_engagement_helper.h b/chrome/browser/engagement/site_engagement_helper.h
index 4a331af6c07c3064eaff7e146f64bbf9032961ad..f55ab586b550d7575776d6cbeff02627cb8f50d9 100644
--- a/chrome/browser/engagement/site_engagement_helper.h
+++ b/chrome/browser/engagement/site_engagement_helper.h
@@ -8,6 +8,7 @@
#include "base/macros.h"
#include "base/timer/timer.h"
#include "chrome/browser/engagement/site_engagement_metrics.h"
+#include "chrome/browser/engagement/site_engagement_service.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
@@ -16,15 +17,13 @@ class NavigationHandle;
class WebContents;
}
-class GURL;
-
// Per-WebContents class to handle updating the site engagement scores for
// origins.
-class SiteEngagementHelper
+class SiteEngagementService::Helper
: public content::WebContentsObserver,
- public content::WebContentsUserData<SiteEngagementHelper> {
+ public content::WebContentsUserData<SiteEngagementService::Helper> {
public:
- ~SiteEngagementHelper() override;
+ ~Helper() override;
static void SetSecondsBetweenUserInputCheck(int seconds);
static void SetSecondsTrackingDelayAfterNavigation(int seconds);
@@ -42,7 +41,7 @@ class SiteEngagementHelper
// 2. continual engagement over a non-trivial duration of time
class PeriodicTracker {
public:
- explicit PeriodicTracker(SiteEngagementHelper* helper);
+ explicit PeriodicTracker(SiteEngagementService::Helper* helper);
virtual ~PeriodicTracker();
// Begin tracking after |initial_delay|.
@@ -60,7 +59,7 @@ class SiteEngagementHelper
// Set the timer object for testing.
void SetPauseTimerForTesting(std::unique_ptr<base::Timer> timer);
- SiteEngagementHelper* helper() { return helper_; }
+ SiteEngagementService::Helper* helper() { return helper_; }
protected:
friend class SiteEngagementHelperTest;
@@ -76,8 +75,10 @@ class SiteEngagementHelper
virtual void TrackingStopped() {}
private:
- SiteEngagementHelper* helper_;
+ SiteEngagementService::Helper* helper_;
std::unique_ptr<base::Timer> pause_timer_;
+
+ DISALLOW_COPY_AND_ASSIGN(PeriodicTracker);
};
// Class to encapsulate time-on-site engagement detection. Time-on-site is
@@ -90,7 +91,7 @@ class SiteEngagementHelper
class InputTracker : public PeriodicTracker,
public content::WebContentsObserver {
public:
- InputTracker(SiteEngagementHelper* helper,
+ InputTracker(SiteEngagementService::Helper* helper,
content::WebContents* web_contents);
bool is_tracking() const { return is_tracking_; }
@@ -107,6 +108,8 @@ class SiteEngagementHelper
// content::WebContentsObserver overrides.
void DidGetUserInteraction(const blink::WebInputEvent::Type type) override;
+
+ DISALLOW_COPY_AND_ASSIGN(InputTracker);
};
// Class to encapsulate media detection. Any media playing in a WebContents
@@ -122,7 +125,7 @@ class SiteEngagementHelper
class MediaTracker : public PeriodicTracker,
public content::WebContentsObserver {
public:
- MediaTracker(SiteEngagementHelper* helper,
+ MediaTracker(SiteEngagementService::Helper* helper,
content::WebContents* web_contents);
~MediaTracker() override;
@@ -139,10 +142,12 @@ class SiteEngagementHelper
bool is_hidden_;
std::vector<MediaPlayerId> active_media_players_;
+
+ DISALLOW_COPY_AND_ASSIGN(MediaTracker);
};
- explicit SiteEngagementHelper(content::WebContents* web_contents);
- friend class content::WebContentsUserData<SiteEngagementHelper>;
+ explicit Helper(content::WebContents* web_contents);
+ friend class content::WebContentsUserData<SiteEngagementService::Helper>;
friend class SiteEngagementHelperTest;
// Ask the SiteEngagementService to record engagement via user input at the
@@ -162,7 +167,7 @@ class SiteEngagementHelper
MediaTracker media_tracker_;
bool record_engagement_;
- DISALLOW_COPY_AND_ASSIGN(SiteEngagementHelper);
+ DISALLOW_COPY_AND_ASSIGN(Helper);
};
#endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_HELPER_H_
« no previous file with comments | « chrome/browser/engagement/site_engagement_eviction_policy.cc ('k') | chrome/browser/engagement/site_engagement_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698