#include "components/feature_engagement/public/feature_configurations.h"
#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "components/feature_engagement/public/configuration.h"
#include "components/feature_engagement/public/event_constants.h"
#include "components/feature_engagement/public/feature_constants.h"
#if BUILDFLAG(IS_IOS)
#include "base/metrics/field_trial_params.h"
#include "components/feature_engagement/public/ios_promo_feature_configuration.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "components/feature_engagement/public/scalable_iph_feature_configurations.h"
#endif
namespace {
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
const int k10YearsInDays = 365 * 10;
#endif
}
namespace feature_engagement {
FeatureConfig CreateAlwaysTriggerConfig(const base::Feature* feature) { … }
#if BUILDFLAG(IS_IOS)
std::optional<FeatureConfig> CreateNewUserGestureInProductHelpConfig(
const base::Feature& feature,
const char* action_event,
const char* trigger_event,
const char* used_event,
const char* dismiss_button_tap_event) {
const int kTotalMaxOccurrences = 2;
const uint32_t kMaxStorageDays = 61;
const int kDaysBetweenOccurrences = 7;
std::optional<FeatureConfig> config = FeatureConfig();
config->valid = true;
config->availability = Comparator(ANY, 0);
config->session_rate = Comparator(EQUAL, 0);
config->used = EventConfig(used_event, Comparator(EQUAL, 0), kMaxStorageDays,
kMaxStorageDays);
config->trigger =
EventConfig(trigger_event, Comparator(EQUAL, 0), kDaysBetweenOccurrences,
kDaysBetweenOccurrences);
config->event_configs.insert(
EventConfig(trigger_event, Comparator(LESS_THAN, kTotalMaxOccurrences),
kMaxStorageDays, kMaxStorageDays));
config->event_configs.insert(
EventConfig(action_event, Comparator(GREATER_THAN_OR_EQUAL, 2),
kDaysBetweenOccurrences, kDaysBetweenOccurrences));
config->event_configs.insert(EventConfig(dismiss_button_tap_event,
Comparator(EQUAL, 0),
kMaxStorageDays, kMaxStorageDays));
return config;
}
#endif
std::optional<FeatureConfig> GetClientSideFeatureConfig(
const base::Feature* feature) { … }
}