chromium/chrome/browser/ui/hats/survey_config.cc

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "survey_config.h"

#include <optional>

#include "base/feature_list.h"
#include "base/features.h"
#include "chrome/common/chrome_features.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/permissions/features.h"
#include "components/permissions/permission_hats_trigger_helper.h"
#include "components/privacy_sandbox/privacy_sandbox_features.h"

#if !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/download/download_warning_desktop_hats_utils.h"
#include "components/password_manager/core/browser/features/password_features.h"  // nogncheck
#include "components/performance_manager/public/features.h"  // nogncheck
#include "components/permissions/constants.h"                // nogncheck
#include "components/safe_browsing/core/common/features.h"   // nogncheck
#include "components/safe_browsing/core/common/safebrowsing_constants.h"  // nogncheck
#else
#include "chrome/browser/flags/android/chrome_feature_list.h"
#endif  // #if !BUILDFLAG(IS_ANDROID)

#if !BUILDFLAG(IS_ANDROID)
constexpr char kHatsSurveyTriggerAutofillAddress[] =;
constexpr char kHatsSurveyTriggerAutofillAddressUserPerception[] =;
constexpr char kHatsSurveyTriggerAutofillCreditCardUserPerception[] =;
constexpr char kHatsSurveyTriggerAutofillPasswordUserPerception[] =;
constexpr char kHatsSurveyTriggerAutofillCard[] =;
constexpr char kHatsSurveyTriggerAutofillPassword[] =;
constexpr char kHatsSurveyTriggerDownloadWarningBubbleBypass[] =;
constexpr char kHatsSurveyTriggerDownloadWarningBubbleHeed[] =;
constexpr char kHatsSurveyTriggerDownloadWarningBubbleIgnore[] =;
constexpr char kHatsSurveyTriggerDownloadWarningPageBypass[] =;
constexpr char kHatsSurveyTriggerDownloadWarningPageHeed[] =;
constexpr char kHatsSurveyTriggerDownloadWarningPageIgnore[] =;
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
constexpr char kHatsSurveyTriggerGetMostChrome[] = "get-most-chrome";
#endif
constexpr char kHatsSurveyTriggerM1AdPrivacyPage[] =;
constexpr char kHatsSurveyTriggerM1TopicsSubpage[] =;
constexpr char kHatsSurveyTriggerM1FledgeSubpage[] =;
constexpr char kHatsSurveyTriggerM1AdMeasurementSubpage[] =;
constexpr char kHatsSurveyTriggerNtpModules[] =;
constexpr char kHatsSurveyTriggerNtpPhotosModuleOptOut[] =;
constexpr char kHatsSurveyTriggerPerformanceControlsPerformance[] =;
constexpr char kHatsSurveyTriggerPerformanceControlsBatteryPerformance[] =;
constexpr char kHatsSurveyTriggerPerformanceControlsMemorySaverOptOut[] =;
constexpr char kHatsSurveyTriggerPerformanceControlsBatterySaverOptOut[] =;
// The permission prompt trigger permits configuring multiple triggers
// simultaneously. Each trigger increments a counter at the end -->
// "permission-prompt0", "permission-prompt1", ...
constexpr char kHatsSurveyTriggerPrivacyGuide[] =;
constexpr char kHatsSurveyTriggerRedWarning[] =;
constexpr char kHatsSurveyTriggerSettings[] =;
constexpr char kHatsSurveyTriggerSettingsPrivacy[] =;
constexpr char kHatsSurveyTriggerSettingsSecurity[] =;
constexpr char kHatsSurveyTriggerSuggestedPasswordsExperiment[] =;
constexpr char kHatsSurveyTriggerTrustSafetyPrivacySandbox4ConsentAccept[] =;
constexpr char kHatsSurveyTriggerTrustSafetyPrivacySandbox4ConsentDecline[] =;
constexpr char kHatsSurveyTriggerTrustSafetyPrivacySandbox4NoticeOk[] =;
constexpr char kHatsSurveyTriggerTrustSafetyPrivacySandbox4NoticeSettings[] =;
constexpr char kHatsSurveyTriggerTrustSafetyPrivacySettings[] =;
constexpr char kHatsSurveyTriggerTrustSafetyTrustedSurface[] =;
constexpr char kHatsSurveyTriggerTrustSafetyTransactions[] =;
constexpr char kHatsSurveyTriggerWhatsNew[] =;
constexpr char kHatsSurveyTriggerWhatsNewAlternate[] =;
constexpr char kHatsSurveyTriggerTrustSafetyV2BrowsingData[] =;
constexpr char kHatsSurveyTriggerTrustSafetyV2ControlGroup[] =;
constexpr char kHatsSurveyTriggerTrustSafetyV2DownloadWarningUI[] =;
constexpr char kHatsSurveyTriggerTrustSafetyV2PasswordCheck[] =;
constexpr char kHatsSurveyTriggerTrustSafetyV2PasswordProtectionUI[] =;
constexpr char kHatsSurveyTriggerTrustSafetyV2SafetyCheck[] =;
constexpr char kHatsSurveyTriggerTrustSafetyV2SafetyHubNotification[] =;
constexpr char kHatsSurveyTriggerTrustSafetyV2SafetyHubInteraction[] =;
constexpr char kHatsSurveyTriggerTrustSafetyV2TrustedSurface[] =;
constexpr char kHatsSurveyTriggerTrustSafetyV2PrivacyGuide[] =;
constexpr char kHatsSurveyTriggerTrustSafetyV2PrivacySandbox4ConsentAccept[] =;
constexpr char kHatsSurveyTriggerTrustSafetyV2PrivacySandbox4ConsentDecline[] =;
constexpr char kHatsSurveyTriggerTrustSafetyV2PrivacySandbox4NoticeOk[] =;
constexpr char kHatsSurveyTriggerTrustSafetyV2PrivacySandbox4NoticeSettings[] =;
constexpr char kHatsSurveyTriggerTrustSafetyV2SafeBrowsingInterstitial[] =;
constexpr char kHatsSurveyTriggerWallpaperSearch[] =;
#else   // BUILDFLAG(IS_ANDROID)
constexpr char kHatsSurveyTriggerAndroidStartupSurvey[] = "startup_survey";
constexpr char kHatsSurveyTriggerQuickDelete[] = "quick_delete_survey";
constexpr char kHatsSurveyTriggerSafetyHubAndroid[] =
    "safety_hub_android_survey";
#endif  // #if !BUILDFLAG(IS_ANDROID)

constexpr char kHatsSurveyTriggerTesting[] =;
constexpr char kHatsNextSurveyTriggerIDTesting[] =;

constexpr char kHatsSurveyTriggerPermissionsPrompt[] =;
constexpr char kHatsSurveyTriggerPrivacySandboxSentimentSurvey[] =;

namespace {

constexpr char kHatsSurveyProbability[] =;
constexpr char kHatsSurveyEnSiteID[] =;
constexpr char kHatsSurveyHistogramName[] =;
constexpr double kHatsSurveyProbabilityDefault =;

// Survey configs must always be hardcoded here, so that they require review
// from HaTS owners. Do not move this method out of the anonymous namespace or
// change its signature to work around this.
std::vector<hats::SurveyConfig> GetAllSurveyConfigs() {}

}  // namespace

namespace hats {

SurveyConfig::SurveyConfig() = default;
SurveyConfig::SurveyConfig(const SurveyConfig&) = default;
SurveyConfig::~SurveyConfig() = default;

SurveyConfig::SurveyConfig(
    const base::Feature* feature,
    const std::string& trigger,
    const std::optional<std::string>& presupplied_trigger_id,
    const std::vector<std::string>& product_specific_bits_data_fields,
    const std::vector<std::string>& product_specific_string_data_fields,
    bool log_responses_to_uma)
    :{}

void GetActiveSurveyConfigs(SurveyConfigs& survey_configs_by_triggers_) {}

}  // namespace hats