diff --git a/components/brave_ads/common/features.cc b/components/brave_ads/common/features.cc index 13c0d25a3a0e..b62d21b9c4b4 100644 --- a/components/brave_ads/common/features.cc +++ b/components/brave_ads/common/features.cc @@ -18,6 +18,12 @@ const base::Feature kCustomAdNotifications{"CustomAdNotifications", namespace { +// Set to true to fallback to custom ad notifications if native notifications +// are disabled or false to never fallback +const char kFieldTrialParameterCanFallbackToCustomAdNotifications[] = + "can_fallback_to_custom_notifications"; +const bool kDefaultCanFallbackToCustomAdNotifications = false; + // Ad notification timeout in seconds. Set to 0 to never time out const char kFieldTrialParameterAdNotificationTimeout[] = "ad_notification_timeout"; @@ -27,12 +33,6 @@ const int kDefaultAdNotificationTimeout = 120; const int kDefaultAdNotificationTimeout = 30; #endif -// Set to true to fallback from native to custom ad notifications or false to -// never fallback -const char kFieldTrialParameterCanFallbackToCustomAdNotifications[] = - "can_fallback_to_custom_notifications"; -const bool kDefaultCanFallbackToCustomAdNotifications = false; - #if !defined(OS_ANDROID) // Ad notification fade animation duration in milliseconds @@ -105,6 +105,12 @@ bool IsAdNotificationsEnabled() { return base::FeatureList::IsEnabled(kAdNotifications); } +bool CanFallbackToCustomAdNotifications() { + return GetFieldTrialParamByFeatureAsBool( + kAdNotifications, kFieldTrialParameterCanFallbackToCustomAdNotifications, + kDefaultCanFallbackToCustomAdNotifications); +} + int AdNotificationTimeout() { return GetFieldTrialParamByFeatureAsInt( kAdNotifications, kFieldTrialParameterAdNotificationTimeout, @@ -115,13 +121,6 @@ bool IsCustomAdNotificationsEnabled() { return base::FeatureList::IsEnabled(kCustomAdNotifications); } -bool CanFallbackToCustomAdNotifications() { - return GetFieldTrialParamByFeatureAsBool( - kCustomAdNotifications, - kFieldTrialParameterCanFallbackToCustomAdNotifications, - kDefaultCanFallbackToCustomAdNotifications); -} - #if !defined(OS_ANDROID) int AdNotificationFadeDuration() { diff --git a/components/brave_ads/common/features.h b/components/brave_ads/common/features.h index 19b5349d628b..14307a220582 100644 --- a/components/brave_ads/common/features.h +++ b/components/brave_ads/common/features.h @@ -20,13 +20,12 @@ namespace features { extern const base::Feature kAdNotifications; bool IsAdNotificationsEnabled(); +bool CanFallbackToCustomAdNotifications(); int AdNotificationTimeout(); extern const base::Feature kCustomAdNotifications; bool IsCustomAdNotificationsEnabled(); - -bool CanFallbackToCustomAdNotifications(); #if !defined(OS_ANDROID) int AdNotificationFadeDuration(); std::string AdNotificationDarkModeBackgroundColor();