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

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

Issue 1373453002: Allow the site engagement service thresholds to be varied via field trial. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@time-on-site-uma
Patch Set: Privatising content settings and params keys Created 5 years, 3 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.h
diff --git a/chrome/browser/engagement/site_engagement_service.h b/chrome/browser/engagement/site_engagement_service.h
index 3c57983619b66eb88529d483661bc405171dc5e2..47ee9892be814432e4f170e499ad1fd0b311801b 100644
--- a/chrome/browser/engagement/site_engagement_service.h
+++ b/chrome/browser/engagement/site_engagement_service.h
@@ -25,29 +25,27 @@ class Profile;
class SiteEngagementScore {
public:
- // Keys used in the content settings dictionary.
- static const char* kRawScoreKey;
- static const char* kPointsAddedTodayKey;
- static const char* kLastEngagementTimeKey;
-
// The maximum number of points that are allowed.
static const double kMaxPoints;
// The maximum number of points that can be accrued in one day.
- static const double kMaxPointsPerDay;
+ static double gMaxPointsPerDay;
// The number of points given for navigations.
- static const double kNavigationPoints;
+ static double gNavigationPoints;
// The number of points given for user input (indicating time-on-site).
- static const double kUserInputPoints;
+ static double gUserInputPoints;
// Decaying works by removing a portion of the score periodically. This
// constant determines how often that happens.
- static const int kDecayPeriodInDays;
+ static int gDecayPeriodInDays;
// How much the score decays after every kDecayPeriodInDays.
- static const double kDecayPoints;
+ static double gDecayPoints;
+
+ // Update the default engagement settings via variations.
+ static void UpdateFromVariations();
// The SiteEngagementService does not take ownership of |clock|. It is the
// responsibility of the caller to make sure |clock| outlives this
@@ -68,8 +66,23 @@ class SiteEngagementScore {
bool UpdateScoreDict(base::DictionaryValue* score_dict);
private:
+ FRIEND_TEST_ALL_PREFIXES(SiteEngagementScoreTest, PartiallyEmptyDictionary);
+ FRIEND_TEST_ALL_PREFIXES(SiteEngagementScoreTest, PopulatedDictionary);
friend class SiteEngagementScoreTest;
+ // Keys used in the content settings dictionary.
+ static const char* kRawScoreKey;
+ static const char* kPointsAddedTodayKey;
+ static const char* kLastEngagementTimeKey;
+
+ // Keys used in the variations params.
+ static const char* kEngagementParams;
benwells 2015/10/02 01:37:43 Nit: are these needed in tests? If not they should
dominickn 2015/10/02 06:29:05 Done.
+ static const char* kMaxPointsPerDayParam;
+ static const char* kNavigationPointsParam;
+ static const char* kUserInputPointsParam;
+ static const char* kDecayPeriodInDaysParam;
+ static const char* kDecayPointsParam;
+
// This version of the constructor is used in unit tests.
explicit SiteEngagementScore(base::Clock* clock);

Powered by Google App Engine
This is Rietveld 408576698