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

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

Issue 1221523003: Add a SiteEngagementEvictionPolicy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@get_total_engagement_points
Patch Set: remove unnecessary destructor Created 5 years, 4 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
« no previous file with comments | « chrome/browser/engagement/site_engagement_eviction_policy_unittest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f5494de945bdf42c309ecafc646cae6e8bbf052e..60644a4a4e3f504721d10a8a2e0666eb635dac34 100644
--- a/chrome/browser/engagement/site_engagement_service.h
+++ b/chrome/browser/engagement/site_engagement_service.h
@@ -7,7 +7,6 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/time/default_clock.h"
#include "base/time/time.h"
#include "components/keyed_service/core/keyed_service.h"
@@ -84,6 +83,16 @@ class SiteEngagementScore {
DISALLOW_COPY_AND_ASSIGN(SiteEngagementScore);
};
+class SiteEngagementScoreProvider {
+ public:
+ // Returns a non-negative integer representing the engagement score of the
+ // origin for this URL.
+ virtual int GetScore(const GURL& url) = 0;
+
+ // Returns the sum of engagement points awarded to all sites.
+ virtual int GetTotalEngagementPoints() = 0;
+};
+
// Stores and retrieves the engagement score of an origin.
//
// An engagement score is a positive integer that represents how much a user has
@@ -94,7 +103,8 @@ class SiteEngagementScore {
// the homescreen, will increase the site engagement score. Negative activity,
// such as rejecting permission prompts or not responding to notifications, will
// decrease the site engagement score.
-class SiteEngagementService : public KeyedService {
+class SiteEngagementService : public KeyedService,
+ public SiteEngagementScoreProvider {
public:
static SiteEngagementService* Get(Profile* profile);
@@ -107,12 +117,9 @@ class SiteEngagementService : public KeyedService {
// Update the karma score of the origin matching |url| for user navigation.
void HandleNavigation(const GURL& url);
- // Returns a non-negative integer representing the engagement score of the
- // origin for this URL.
- int GetScore(const GURL& url);
-
- // Returns the sum of engagement points awarded to all sites.
- int GetTotalEngagementPoints();
+ // Overridden from SiteEngagementScoreProvider:
+ int GetScore(const GURL& url) override;
+ int GetTotalEngagementPoints() override;
private:
Profile* profile_;
« no previous file with comments | « chrome/browser/engagement/site_engagement_eviction_policy_unittest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698