Skip to content

Commit 26dff20

Browse files
committed
Added RequestAdsEnabledApi feature and mojom interface.
fix brave/brave-browser#16964
1 parent 0765b3c commit 26dff20

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

components/brave_ads/common/BUILD.gn

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
import("//mojo/public/tools/bindings/mojom.gni")
2+
3+
mojom("mojom") {
4+
sources = [ "brave_ads_host.mojom" ]
5+
6+
deps = [ "//mojo/public/mojom/base" ]
7+
}
8+
19
static_library("common") {
210
sources = [
311
"features.cc",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module brave_ads.mojom;
2+
3+
interface BraveAdsHost {
4+
RequestAdsEnabled() => (bool result);
5+
};

components/brave_ads/common/features.cc

+7
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ const base::Feature kAdNotifications{"AdNotifications",
1616
const base::Feature kCustomAdNotifications{"CustomAdNotifications",
1717
base::FEATURE_DISABLED_BY_DEFAULT};
1818

19+
const base::Feature kRequestAdsEnabledApi{"RequestAdsEnabledApi",
20+
base::FEATURE_DISABLED_BY_DEFAULT};
21+
1922
namespace {
2023

2124
// Set to true to fallback to custom ad notifications if native notifications
@@ -169,5 +172,9 @@ int AdNotificationInsetY() {
169172

170173
#endif // !defined(OS_ANDROID)
171174

175+
bool IsRequestAdsEnabledApiEnabled() {
176+
return base::FeatureList::IsEnabled(kRequestAdsEnabledApi);
177+
}
178+
172179
} // namespace features
173180
} // namespace brave_ads

components/brave_ads/common/features.h

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ double AdNotificationNormalizedDisplayCoordinateY();
3535
int AdNotificationInsetY();
3636
#endif // !defined(OS_ANDROID)
3737

38+
extern const base::Feature kRequestAdsEnabledApi;
39+
40+
bool IsRequestAdsEnabledApiEnabled();
41+
3842
} // namespace features
3943
} // namespace brave_ads
4044

0 commit comments

Comments
 (0)