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

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

Issue 1363523003: Enable SiteEngagementEvictionPolicy behind --enable-site-eviction-policy flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lru_policy_gooood
Patch Set: Created 5 years, 1 month 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_service.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9e7798cd6dc77adce456d32667de46076d3a7149..500498abb13c3a31e881afe5c0bb8316f6b22dee 100644
--- a/chrome/browser/engagement/site_engagement_service.cc
+++ b/chrome/browser/engagement/site_engagement_service.cc
@@ -15,6 +15,7 @@
#include "base/time/default_clock.h"
#include "base/values.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
+#include "chrome/browser/engagement/site_engagement_eviction_policy.h"
#include "chrome/browser/engagement/site_engagement_helper.h"
#include "chrome/browser/engagement/site_engagement_service_factory.h"
#include "chrome/common/chrome_switches.h"
@@ -30,7 +31,6 @@ namespace {
bool g_updated_from_variations = false;
// Keys used in the variations params.
-const char kEngagementParams[] = "SiteEngagement";
const char kMaxPointsPerDayParam[] = "max_points_per_day";
const char kNavigationPointsParam[] = "navigation_points";
const char kUserInputPointsParam[] = "user_input_points";
@@ -110,15 +110,15 @@ const char* SiteEngagementScore::kLastEngagementTimeKey = "lastEngagementTime";
void SiteEngagementScore::UpdateFromVariations() {
std::string max_points_per_day_param = variations::GetVariationParamValue(
- kEngagementParams, kMaxPointsPerDayParam);
+ SiteEngagementService::kEngagementParams, kMaxPointsPerDayParam);
std::string navigation_points_param = variations::GetVariationParamValue(
- kEngagementParams, kNavigationPointsParam);
+ SiteEngagementService::kEngagementParams, kNavigationPointsParam);
std::string user_input_points_param = variations::GetVariationParamValue(
- kEngagementParams, kUserInputPointsParam);
+ SiteEngagementService::kEngagementParams, kUserInputPointsParam);
std::string decay_period_in_days_param = variations::GetVariationParamValue(
- kEngagementParams, kDecayPeriodInDaysParam);
+ SiteEngagementService::kEngagementParams, kDecayPeriodInDaysParam);
std::string decay_points_param = variations::GetVariationParamValue(
- kEngagementParams, kDecayPointsParam);
+ SiteEngagementService::kEngagementParams, kDecayPointsParam);
if (!max_points_per_day_param.empty() && !navigation_points_param.empty() &&
!user_input_points_param.empty() && !decay_period_in_days_param.empty() &&
@@ -243,6 +243,8 @@ double SiteEngagementScore::DecayedScore() const {
return std::max(0.0, decayed_score);
}
+const char SiteEngagementService::kEngagementParams[] = "SiteEngagement";
+
// static
SiteEngagementService* SiteEngagementService::Get(Profile* profile) {
return SiteEngagementServiceFactory::GetForProfile(profile);
@@ -250,16 +252,20 @@ SiteEngagementService* SiteEngagementService::Get(Profile* profile) {
// static
bool SiteEngagementService::IsEnabled() {
- const std::string group_name =
- base::FieldTrialList::FindFullName(kEngagementParams);
+ // If the engagement service or any of its dependencies are force-enabled,
+ // return true immediately.
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableSiteEngagementService)) {
+ switches::kEnableSiteEngagementService) ||
+ SiteEngagementEvictionPolicy::IsEnabled()) {
return true;
}
+
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableSiteEngagementService)) {
return false;
}
+ const std::string group_name =
+ base::FieldTrialList::FindFullName(kEngagementParams);
return base::StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE);
}
« no previous file with comments | « chrome/browser/engagement/site_engagement_service.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698