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

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

Issue 1393723002: Allow SiteEngagementService::IsEnabled to respect field trial groups. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@time-on-site-finch
Patch Set: Rebase Created 5 years, 2 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 | « no previous file | no next file » | 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 1658c3f7e458a93ee902c2296f6d2898c73b4d1e..f9c9fe38baf781fca1c77fbfb1cf85b628ef673f 100644
--- a/chrome/browser/engagement/site_engagement_service.cc
+++ b/chrome/browser/engagement/site_engagement_service.cc
@@ -9,6 +9,7 @@
#include <vector>
#include "base/command_line.h"
+#include "base/metrics/field_trial.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/clock.h"
#include "base/time/default_clock.h"
@@ -254,8 +255,17 @@ SiteEngagementService* SiteEngagementService::Get(Profile* profile) {
// static
bool SiteEngagementService::IsEnabled() {
- return base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableSiteEngagementService);
+ const std::string group_name =
+ base::FieldTrialList::FindFullName(kEngagementParams);
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableSiteEngagementService)) {
+ return true;
+ }
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableSiteEngagementService)) {
+ return false;
+ }
+ return base::StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE);
}
// static
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698