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

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

Issue 1650983002: Add an IsBootstrapped method to the SiteEngagementService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@adjust_constants
Patch Set: address comments Created 4 years, 10 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.cc
diff --git a/chrome/browser/engagement/site_engagement_service.cc b/chrome/browser/engagement/site_engagement_service.cc
index ba0e74dd54de955f2aa1a583b897e198d336ad7b..51a35eec1584c3ebf358da5b5acfcb15f1becbf4 100644
--- a/chrome/browser/engagement/site_engagement_service.cc
+++ b/chrome/browser/engagement/site_engagement_service.cc
@@ -126,6 +126,7 @@ double SiteEngagementScore::param_values[] = {
0.01, // HIDDEN_MEDIA_POINTS
5, // WEB_APP_INSTALLED_POINTS
0.5, // FIRST_DAILY_ENGAGEMENT
+ 8, // BOOTSTRAP_POINTS
};
const char* SiteEngagementScore::kRawScoreKey = "rawScore";
@@ -170,6 +171,10 @@ double SiteEngagementScore::GetFirstDailyEngagementPoints() {
return param_values[FIRST_DAILY_ENGAGEMENT];
}
+double SiteEngagementScore::GetBootstrapPoints() {
+ return param_values[BOOTSTRAP_POINTS];
+}
+
void SiteEngagementScore::UpdateFromVariations() {
double param_vals[MAX_VARIATION];
@@ -334,6 +339,7 @@ void SiteEngagementScore::SetParamValuesForTesting() {
param_values[VISIBLE_MEDIA_POINTS] = 0.02;
param_values[HIDDEN_MEDIA_POINTS] = 0.01;
param_values[WEB_APP_INSTALLED_POINTS] = 5;
+ param_values[BOOTSTRAP_POINTS] = 8;
// This is set to zero to avoid interference with tests and is set when
// testing this functionality.
@@ -519,6 +525,11 @@ std::map<GURL, double> SiteEngagementService::GetScoreMap() {
return score_map;
}
+bool SiteEngagementService::IsBootstrapped() {
+ return GetTotalEngagementPoints() >=
+ SiteEngagementScore::GetBootstrapPoints();
+}
+
SiteEngagementService::SiteEngagementService(Profile* profile,
scoped_ptr<base::Clock> clock)
: profile_(profile), clock_(std::move(clock)), weak_factory_(this) {
« no previous file with comments | « chrome/browser/engagement/site_engagement_service.h ('k') | chrome/browser/engagement/site_engagement_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698