Commit 222a0a09 authored by sauski's avatar sauski Committed by Chromium LUCI CQ

HaTS: Increase survey cooldown & sync pref

Extends the survey cooldown period to 180 days for both any survey, and
any particular survey.

Also moves the preference to be synced so that the survey cooldowns
apply across synced user devices.

Bug: 1110888
Change-Id: Ic04d18d9551b809ae4ee10fe7b174a1b60567a5f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2599534
Commit-Queue: Theodore Olsauskas-Warren <sauski@google.com>
Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842488}
parent 2261c4e1
......@@ -23,7 +23,7 @@
#include "chrome/common/chrome_features.h"
#include "chrome/common/pref_names.h"
#include "components/metrics_services_manager/metrics_services_manager.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "components/version_info/version_info.h"
#include "content/public/browser/browser_thread.h"
......@@ -51,11 +51,14 @@ constexpr double kHatsSurveyProbabilityDefault = 0;
constexpr char kHatsSurveyEnSiteIDDefault[] = "bhej2dndhpc33okm6xexsbyv4y";
// TODO(crbug.com/1160661): When the minimum time between any survey, and the
// minimum time between a specific survey, are the same, the logic supporting
// the latter check is superfluous.
constexpr base::TimeDelta kMinimumTimeBetweenSurveyStarts =
base::TimeDelta::FromDays(60);
base::TimeDelta::FromDays(180);
constexpr base::TimeDelta kMinimumTimeBetweenAnySurveyStarts =
base::TimeDelta::FromDays(7);
base::TimeDelta::FromDays(180);
constexpr base::TimeDelta kMinimumTimeBetweenSurveyChecks =
base::TimeDelta::FromDays(1);
......@@ -187,8 +190,11 @@ HatsService::HatsService(Profile* profile) : profile_(profile) {
HatsService::~HatsService() = default;
// static
void HatsService::RegisterProfilePrefs(PrefRegistrySimple* registry) {
registry->RegisterDictionaryPref(prefs::kHatsSurveyMetadata);
void HatsService::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterDictionaryPref(
prefs::kHatsSurveyMetadata,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
}
void HatsService::LaunchSurvey(const std::string& trigger,
......
......@@ -23,8 +23,11 @@ namespace content {
class WebContents;
}
namespace user_prefs {
class PrefRegistrySyncable;
}
class Browser;
class PrefRegistrySimple;
class Profile;
// Trigger identifiers currently used; duplicates not allowed.
......@@ -144,7 +147,7 @@ class HatsService : public KeyedService {
explicit HatsService(Profile* profile);
static void RegisterProfilePrefs(PrefRegistrySimple* registry);
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
// Launches survey with identifier |trigger| if appropriate.
// |success_callback| is called when the survey is shown to the user.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment