Disable Brave Ads for Brave Origin (#33309)
The PR does the following: * Adds buildflag static asserts to Brave Ads public facing headers * Moves remaining Brave Ads code for Desktop builds under a build flag * Sets Brave Ads build flag to false for Brave Origin build
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
#include "brave/browser/profiles/brave_profile_manager.h"
|
||||
#include "brave/common/brave_channel_info.h"
|
||||
#include "brave/components/ai_chat/core/common/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_component_updater/browser/brave_component_updater_delegate.h"
|
||||
#include "brave/components/brave_component_updater/browser/local_data_files_service.h"
|
||||
#include "brave/components/brave_origin/brave_origin_policy_manager.h"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "base/sequence_checker.h"
|
||||
#include "brave/browser/brave_browser_process.h"
|
||||
#include "brave/components/ai_chat/core/common/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_component_updater/browser/brave_component.h"
|
||||
#include "brave/components/brave_vpn/common/buildflags/buildflags.h"
|
||||
#include "brave/components/speedreader/common/buildflags/buildflags.h"
|
||||
@@ -74,10 +75,12 @@ namespace speedreader {
|
||||
class SpeedreaderRewriterService;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
namespace brave_ads {
|
||||
class BraveStatsHelper;
|
||||
class ResourceComponent;
|
||||
} // namespace brave_ads
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
namespace ai_chat {
|
||||
#if BUILDFLAG(ENABLE_BRAVE_AI_CHAT_AGENT_PROFILE)
|
||||
@@ -125,10 +128,12 @@ class BraveBrowserProcessImpl : public BraveBrowserProcess,
|
||||
p3a::P3AService* p3a_service() override;
|
||||
brave::BraveReferralsService* brave_referrals_service() override;
|
||||
brave_stats::BraveStatsUpdater* brave_stats_updater() override;
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
brave_ads::BraveStatsHelper* ads_brave_stats_helper() override;
|
||||
brave_ads::ResourceComponent* resource_component() override;
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
ntp_background_images::NTPBackgroundImagesService*
|
||||
ntp_background_images_service() override;
|
||||
brave_ads::ResourceComponent* resource_component() override;
|
||||
#if BUILDFLAG(ENABLE_SPEEDREADER)
|
||||
speedreader::SpeedreaderRewriterService* speedreader_rewriter_service()
|
||||
override;
|
||||
@@ -194,7 +199,11 @@ class BraveBrowserProcessImpl : public BraveBrowserProcess,
|
||||
scoped_refptr<p3a::HistogramsBraveizer> histogram_braveizer_;
|
||||
std::unique_ptr<ntp_background_images::NTPBackgroundImagesService>
|
||||
ntp_background_images_service_;
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
std::unique_ptr<brave_ads::ResourceComponent> resource_component_;
|
||||
std::unique_ptr<brave_ads::BraveStatsHelper> brave_stats_helper_;
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
#if BUILDFLAG(ENABLE_SPEEDREADER)
|
||||
std::unique_ptr<speedreader::SpeedreaderRewriterService>
|
||||
@@ -207,7 +216,6 @@ class BraveBrowserProcessImpl : public BraveBrowserProcess,
|
||||
#endif
|
||||
|
||||
std::unique_ptr<misc_metrics::ProcessMiscMetrics> process_misc_metrics_;
|
||||
std::unique_ptr<brave_ads::BraveStatsHelper> brave_stats_helper_;
|
||||
|
||||
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID)
|
||||
std::unique_ptr<DayZeroBrowserUIExptManager>
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <memory>
|
||||
|
||||
#include "base/no_destructor.h"
|
||||
#include "brave/browser/brave_ads/ads_service_factory.h"
|
||||
#include "brave/browser/brave_news/direct_feed_fetcher_delegate_impl.h"
|
||||
#include "brave/components/brave_news/browser/brave_news_controller.h"
|
||||
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
|
||||
@@ -51,7 +50,6 @@ BraveNewsControllerFactory::BraveNewsControllerFactory()
|
||||
: BrowserContextKeyedServiceFactory(
|
||||
"BraveNewsControllerFactory",
|
||||
BrowserContextDependencyManager::GetInstance()) {
|
||||
DependsOn(brave_ads::AdsServiceFactory::GetInstance());
|
||||
DependsOn(HistoryServiceFactory::GetInstance());
|
||||
DependsOn(HostContentSettingsMapFactory::GetInstance());
|
||||
}
|
||||
@@ -72,14 +70,12 @@ BraveNewsControllerFactory::BuildServiceInstanceForBrowserContext(
|
||||
if (!profile) {
|
||||
return nullptr;
|
||||
}
|
||||
auto* ads_service = brave_ads::AdsServiceFactory::GetForProfile(profile);
|
||||
auto* history_service = HistoryServiceFactory::GetForProfile(
|
||||
profile, ServiceAccessType::EXPLICIT_ACCESS);
|
||||
auto* host_content_settings_map =
|
||||
HostContentSettingsMapFactory::GetForProfile(profile);
|
||||
return std::make_unique<BraveNewsController>(
|
||||
profile->GetPrefs(), ads_service, history_service,
|
||||
profile->GetURLLoaderFactory(),
|
||||
profile->GetPrefs(), history_service, profile->GetURLLoaderFactory(),
|
||||
std::make_unique<DirectFeedFetcherDelegateImpl>(
|
||||
host_content_settings_map));
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
import("//brave/components/brave_ads/buildflags/buildflags.gni")
|
||||
|
||||
source_set("brave_search") {
|
||||
sources = [
|
||||
"backup_results_navigation_throttle.cc",
|
||||
@@ -43,7 +45,7 @@ if (!is_android) {
|
||||
deps = [
|
||||
":brave_search",
|
||||
"//base/test:test_support",
|
||||
"//brave/components/brave_ads/core/public:headers",
|
||||
"//brave/components/brave_ads/buildflags",
|
||||
"//brave/components/brave_rewards/core",
|
||||
"//brave/components/brave_search/browser",
|
||||
"//brave/components/brave_search/common",
|
||||
@@ -56,6 +58,10 @@ if (!is_android) {
|
||||
"//net:test_support",
|
||||
]
|
||||
|
||||
if (enable_brave_ads) {
|
||||
deps += [ "//brave/components/brave_ads/core/public:headers" ]
|
||||
}
|
||||
|
||||
defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
#include "base/strings/strcat.h"
|
||||
#include "base/test/scoped_feature_list.h"
|
||||
#include "base/test/thread_test_helper.h"
|
||||
#include "brave/components/brave_ads/core/public/prefs/pref_names.h"
|
||||
#include "brave/components/brave_rewards/core/pref_names.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_search/browser/brave_search_fallback_host.h"
|
||||
#include "brave/components/brave_search/common/features.h"
|
||||
#include "brave/components/constants/brave_paths.h"
|
||||
@@ -36,6 +35,11 @@
|
||||
#include "net/test/embedded_test_server/http_response.h"
|
||||
#include "third_party/abseil-cpp/absl/strings/str_format.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
#include "brave/components/brave_ads/core/public/prefs/pref_names.h"
|
||||
#include "brave/components/brave_rewards/core/pref_names.h"
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
using extensions::ExtensionBrowserTest;
|
||||
using RequestExpectationsCallback =
|
||||
base::RepeatingCallback<void(const net::test_server::HttpRequest& request)>;
|
||||
@@ -49,8 +53,6 @@ constexpr char kNotAllowedDomain[] = "brave.com";
|
||||
constexpr char kBraveSearchPath[] = "/bravesearch.html";
|
||||
constexpr char kPageWithCookie[] = "/simple_page_with_cookie.html";
|
||||
constexpr char kPageWithoutCookie[] = "/simple_page_without_cookie.html";
|
||||
constexpr char kSearchAdsHeader[] = "Brave-Search-Ads";
|
||||
constexpr char kSearchAdsDisabledValue[] = "?0";
|
||||
constexpr char kBackupSearchRedirectContent[] = R"(
|
||||
<html>
|
||||
<head>
|
||||
@@ -84,6 +86,11 @@ constexpr char kScriptDefaultAPIGetValue[] = R"(
|
||||
});
|
||||
)";
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
constexpr char kSearchAdsHeader[] = "Brave-Search-Ads";
|
||||
constexpr char kSearchAdsDisabledValue[] = "?0";
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
std::string GetChromeFetchBackupResultsAvailScript() {
|
||||
return absl::StrFormat(R"(
|
||||
new Promise(resolve => {
|
||||
@@ -344,6 +351,7 @@ IN_PROC_BROWSER_TEST_F(BraveSearchTestDisabled, DefaultAPIInvisibleKnownHost) {
|
||||
EXPECT_EQ(false, content::EvalJs(contents, kScriptDefaultAPIExists));
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
IN_PROC_BROWSER_TEST_F(BraveSearchTest, SearchAdsHeader) {
|
||||
base::RunLoop run_loop;
|
||||
SetRequestExpectationsCallback(base::BindRepeating(
|
||||
@@ -518,6 +526,7 @@ IN_PROC_BROWSER_TEST_F(BraveSearchTest, SearchAdsHeaderIncognitoBrowser) {
|
||||
|
||||
run_loop.Run();
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(BraveSearchTest, CheckNoCookieForFallback) {
|
||||
// Sets cookie for the search backup provider domain
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import("//brave/browser/brave_stats/buildflags.gni")
|
||||
import("//brave/components/brave_ads/buildflags/buildflags.gni")
|
||||
import("//brave/components/brave_wallet/common/buildflags/buildflags.gni")
|
||||
import("//build/buildflag_header.gni")
|
||||
|
||||
@@ -30,7 +31,7 @@ source_set("brave_stats") {
|
||||
"//brave/browser:browser_process",
|
||||
"//brave/browser/brave_stats:buildflags",
|
||||
"//brave/common",
|
||||
"//brave/components/brave_ads/core",
|
||||
"//brave/components/brave_ads/buildflags",
|
||||
"//brave/components/brave_referrals/common",
|
||||
"//brave/components/brave_stats/browser",
|
||||
"//brave/components/brave_wallet/common/buildflags",
|
||||
@@ -48,6 +49,10 @@ source_set("brave_stats") {
|
||||
"//services/network/public/cpp",
|
||||
]
|
||||
|
||||
if (enable_brave_ads) {
|
||||
deps += [ "//brave/components/brave_ads/core" ]
|
||||
}
|
||||
|
||||
if (enable_brave_wallet) {
|
||||
deps += [
|
||||
"//brave/components/brave_wallet/browser",
|
||||
@@ -80,9 +85,8 @@ source_set("unit_tests") {
|
||||
]
|
||||
|
||||
deps = [
|
||||
"//brave/browser/brave_ads",
|
||||
"//brave/browser/brave_stats",
|
||||
"//brave/components/brave_ads/core",
|
||||
"//brave/components/brave_ads/buildflags",
|
||||
"//brave/components/brave_referrals/browser",
|
||||
"//brave/components/brave_rewards/content",
|
||||
"//brave/components/brave_stats/browser",
|
||||
@@ -94,6 +98,13 @@ source_set("unit_tests") {
|
||||
"//components/prefs",
|
||||
]
|
||||
|
||||
if (enable_brave_ads) {
|
||||
deps += [
|
||||
"//brave/browser/brave_ads",
|
||||
"//brave/components/brave_ads/core",
|
||||
]
|
||||
}
|
||||
|
||||
if (enable_brave_wallet) {
|
||||
deps += [
|
||||
"//brave/components/brave_wallet/browser",
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "brave/browser/brave_stats/first_run_util.h"
|
||||
#include "brave/browser/brave_stats/switches.h"
|
||||
#include "brave/common/brave_channel_info.h"
|
||||
#include "brave/components/brave_ads/core/public/prefs/pref_names.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_referrals/common/pref_names.h"
|
||||
#include "brave/components/brave_stats/browser/brave_stats_updater_util.h"
|
||||
#include "brave/components/brave_wallet/common/buildflags/buildflags.h"
|
||||
@@ -49,6 +49,10 @@
|
||||
#include "services/network/public/cpp/simple_url_loader.h"
|
||||
#include "services/network/public/mojom/fetch_api.mojom-shared.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
#include "brave/components/brave_ads/core/public/prefs/pref_names.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_WALLET)
|
||||
#include "brave/components/brave_wallet/browser/pref_names.h"
|
||||
#endif
|
||||
@@ -248,7 +252,11 @@ bool BraveStatsUpdater::IsReferralInitialized() {
|
||||
}
|
||||
|
||||
bool BraveStatsUpdater::IsAdsEnabled() {
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
return pref_service_->GetBoolean(brave_ads::prefs::kEnabledForLastProfile);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void BraveStatsUpdater::OnProfileAdded(Profile* profile) {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "base/time/time.h"
|
||||
#include "brave/browser/brave_stats/features.h"
|
||||
#include "brave/browser/brave_stats/first_run_util.h"
|
||||
#include "brave/components/brave_ads/core/public/prefs/pref_names.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_referrals/common/pref_names.h"
|
||||
#include "brave/components/brave_stats/browser/brave_stats_updater_util.h"
|
||||
#include "brave/components/constants/pref_names.h"
|
||||
@@ -25,6 +25,10 @@
|
||||
#include "net/base/url_util.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
#include "brave/components/brave_ads/core/public/prefs/pref_names.h"
|
||||
#endif
|
||||
|
||||
namespace brave_stats {
|
||||
|
||||
base::Time BraveStatsUpdaterParams::g_current_time;
|
||||
@@ -98,10 +102,12 @@ std::string BraveStatsUpdaterParams::GetReferralCodeParam() const {
|
||||
return referral_promo_code_.empty() ? "none" : referral_promo_code_;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
std::string BraveStatsUpdaterParams::GetAdsEnabledParam() const {
|
||||
return BooleanToString(stats_pref_service_->GetBoolean(
|
||||
brave_ads::prefs::kEnabledForLastProfile));
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
std::string BraveStatsUpdaterParams::GetProcessArchParam() const {
|
||||
if (arch_ == ProcessArch::kArchSkip) {
|
||||
@@ -201,8 +207,10 @@ GURL BraveStatsUpdaterParams::GetUpdateURL(
|
||||
GetDateOfInstallationParam());
|
||||
update_url =
|
||||
net::AppendQueryParameter(update_url, "ref", GetReferralCodeParam());
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
update_url =
|
||||
net::AppendQueryParameter(update_url, "adsEnabled", GetAdsEnabledParam());
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
update_url =
|
||||
net::AppendQueryParameter(update_url, "arch", GetProcessArchParam());
|
||||
return update_url;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "base/gtest_prod_util.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/time/time.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_stats/browser/brave_stats_updater_util.h"
|
||||
|
||||
class BraveStatsUpdaterTest;
|
||||
@@ -45,7 +46,9 @@ class BraveStatsUpdaterParams {
|
||||
std::string GetWeekOfInstallationParam() const;
|
||||
std::string GetDateOfInstallationParam() const;
|
||||
std::string GetReferralCodeParam() const;
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
std::string GetAdsEnabledParam() const;
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
std::string GetProcessArchParam() const;
|
||||
GURL GetUpdateURL(const GURL& base_update_url,
|
||||
std::string_view platform_id,
|
||||
|
||||
@@ -17,10 +17,9 @@
|
||||
#include "base/test/metrics/histogram_tester.h"
|
||||
#include "base/test/scoped_feature_list.h"
|
||||
#include "base/time/time.h"
|
||||
#include "brave/browser/brave_ads/analytics/p3a/brave_stats_helper.h"
|
||||
#include "brave/browser/brave_stats/brave_stats_updater_params.h"
|
||||
#include "brave/browser/brave_stats/features.h"
|
||||
#include "brave/components/brave_ads/core/public/prefs/pref_names.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_referrals/browser/brave_referrals_service.h"
|
||||
#include "brave/components/brave_referrals/common/pref_names.h"
|
||||
#include "brave/components/brave_rewards/content/rewards_service.h"
|
||||
@@ -39,6 +38,11 @@
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "ui/gfx/switches.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
#include "brave/browser/brave_ads/analytics/p3a/brave_stats_helper.h"
|
||||
#include "brave/components/brave_ads/core/public/prefs/pref_names.h"
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
using testing::HasSubstr;
|
||||
|
||||
// npm run test -- brave_unit_tests --filter=BraveStatsUpdaterTest.*
|
||||
@@ -80,8 +84,11 @@ class BraveStatsUpdaterTest : public testing::Test {
|
||||
testing_local_state_.registry());
|
||||
brave::RegisterPrefsForBraveReferralsService(
|
||||
testing_local_state_.registry());
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
brave_ads::BraveStatsHelper::RegisterLocalStatePrefs(
|
||||
testing_local_state_.registry());
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
SetCurrentTimeForTest(base::Time());
|
||||
brave_stats::BraveStatsUpdaterParams::SetFirstRunForTest(true);
|
||||
}
|
||||
@@ -93,10 +100,13 @@ class BraveStatsUpdaterTest : public testing::Test {
|
||||
return std::make_unique<brave_stats::BraveStatsUpdaterParams>(
|
||||
GetLocalState(), brave_stats::ProcessArch::kArchSkip);
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
void SetEnableAds(bool ads_enabled) {
|
||||
GetLocalState()->SetBoolean(brave_ads::prefs::kEnabledForLastProfile,
|
||||
ads_enabled);
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
void SetCurrentTimeForTest(const base::Time& current_time) {
|
||||
brave_stats::BraveStatsUpdaterParams::SetCurrentTimeForTest(current_time);
|
||||
@@ -240,6 +250,7 @@ TEST_F(BraveStatsUpdaterTest, IsMonthlyUpdateNeededLastCheckedNextMonth) {
|
||||
EXPECT_EQ(GetLocalState()->GetInteger(kLastCheckMonth), kThisMonth);
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
TEST_F(BraveStatsUpdaterTest, HasAdsDisabled) {
|
||||
brave_stats::BraveStatsUpdaterParams brave_stats_updater_params(
|
||||
GetLocalState(), brave_stats::ProcessArch::kArchSkip, kToday, kThisWeek,
|
||||
@@ -255,6 +266,7 @@ TEST_F(BraveStatsUpdaterTest, HasAdsEnabled) {
|
||||
SetEnableAds(true);
|
||||
EXPECT_EQ(brave_stats_updater_params.GetAdsEnabledParam(), "true");
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
TEST_F(BraveStatsUpdaterTest, HasArchSkip) {
|
||||
brave_stats::BraveStatsUpdaterParams brave_stats_updater_params(
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
import("//brave/components/brave_ads/buildflags/buildflags.gni")
|
||||
import("//brave/components/tor/buildflags/buildflags.gni")
|
||||
import("//build/config/features.gni")
|
||||
|
||||
@@ -71,12 +72,10 @@ source_set("unit_tests") {
|
||||
"brave_static_redirect_network_delegate_helper_unittest.cc",
|
||||
"brave_system_request_handler_unittest.cc",
|
||||
"brave_user_agent_network_delegate_helper_unittest.cc",
|
||||
"search_ads_header_network_delegate_helper_unittest.cc",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"//brave/components/brave_ads/core",
|
||||
"//brave/components/brave_ads/core/browser/service:test_support",
|
||||
"//brave/components/brave_ads/buildflags",
|
||||
"//brave/components/brave_component_updater/browser",
|
||||
"//brave/components/brave_rewards/core",
|
||||
"//brave/components/brave_rewards/core:features",
|
||||
@@ -99,4 +98,9 @@ source_set("unit_tests") {
|
||||
"//testing/gtest",
|
||||
"//third_party/abseil-cpp:absl",
|
||||
]
|
||||
|
||||
if (enable_brave_ads) {
|
||||
sources += [ "search_ads_header_network_delegate_helper_unittest.cc" ]
|
||||
deps += [ "//brave/components/brave_ads/core" ]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "brave/browser/net/brave_stp_util.h"
|
||||
#include "brave/browser/net/brave_user_agent_network_delegate_helper.h"
|
||||
#include "brave/browser/net/global_privacy_control_network_delegate_helper.h"
|
||||
#include "brave/browser/net/search_ads_header_network_delegate_helper.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_shields/core/common/features.h"
|
||||
#include "brave/components/brave_user_agent/common/features.h"
|
||||
#include "brave/components/brave_wallet/common/buildflags/buildflags.h"
|
||||
@@ -35,6 +35,10 @@
|
||||
#include "net/base/net_errors.h"
|
||||
#include "third_party/blink/public/common/features.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
#include "brave/browser/net/search_ads_header_network_delegate_helper.h"
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_WALLET)
|
||||
#include "brave/browser/net/decentralized_dns_network_delegate_helper.h"
|
||||
#endif
|
||||
@@ -103,9 +107,11 @@ void BraveRequestHandler::SetupCallbacks() {
|
||||
before_start_transaction_callbacks_.push_back(start_transaction_callback);
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
start_transaction_callback =
|
||||
base::BindRepeating(brave::OnBeforeStartTransaction_SearchAdsHeader);
|
||||
before_start_transaction_callbacks_.push_back(start_transaction_callback);
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
if (base::FeatureList::IsEnabled(
|
||||
::brave_shields::features::kBraveAdblockCspRules)) {
|
||||
|
||||
+11
-3
@@ -3,6 +3,7 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
import("//brave/components/brave_ads/buildflags/buildflags.gni")
|
||||
import("//brave/components/brave_wallet/common/buildflags/buildflags.gni")
|
||||
import("//brave/components/tor/buildflags/buildflags.gni")
|
||||
import("//build/config/features.gni")
|
||||
@@ -43,8 +44,6 @@ brave_browser_net_sources = [
|
||||
"//brave/browser/net/global_privacy_control_network_delegate_helper.h",
|
||||
"//brave/browser/net/resource_context_data.cc",
|
||||
"//brave/browser/net/resource_context_data.h",
|
||||
"//brave/browser/net/search_ads_header_network_delegate_helper.cc",
|
||||
"//brave/browser/net/search_ads_header_network_delegate_helper.h",
|
||||
"//brave/browser/net/url_context.cc",
|
||||
"//brave/browser/net/url_context.h",
|
||||
]
|
||||
@@ -62,7 +61,7 @@ brave_browser_net_deps = [
|
||||
"//brave/browser:browser_process",
|
||||
"//brave/browser/profiles:util",
|
||||
"//brave/common",
|
||||
"//brave/components/brave_ads/browser",
|
||||
"//brave/components/brave_ads/buildflags",
|
||||
"//brave/components/brave_component_updater/browser",
|
||||
"//brave/components/brave_referrals/browser",
|
||||
"//brave/components/brave_rewards/core",
|
||||
@@ -116,3 +115,12 @@ if (enable_brave_wallet) {
|
||||
if (enable_extensions) {
|
||||
brave_browser_net_deps += [ "//extensions/common:common_constants" ]
|
||||
}
|
||||
|
||||
if (enable_brave_ads) {
|
||||
brave_browser_net_sources += [
|
||||
"//brave/browser/net/search_ads_header_network_delegate_helper.cc",
|
||||
"//brave/browser/net/search_ads_header_network_delegate_helper.h",
|
||||
]
|
||||
|
||||
brave_browser_net_deps += [ "//brave/components/brave_ads/core" ]
|
||||
}
|
||||
|
||||
@@ -3,18 +3,24 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
brave_browser_notifications_sources = [
|
||||
"//brave/browser/notifications/ads_notification_handler.cc",
|
||||
"//brave/browser/notifications/ads_notification_handler.h",
|
||||
]
|
||||
import("//brave/components/brave_ads/buildflags/buildflags.gni")
|
||||
|
||||
brave_browser_notifications_sources = []
|
||||
brave_browser_notifications_deps = [
|
||||
"//base",
|
||||
"//brave/components/brave_ads/buildflags",
|
||||
"//chrome/browser/notifications",
|
||||
"//third_party/abseil-cpp:absl",
|
||||
"//url",
|
||||
]
|
||||
|
||||
if (enable_brave_ads) {
|
||||
brave_browser_notifications_sources += [
|
||||
"//brave/browser/notifications/ads_notification_handler.cc",
|
||||
"//brave/browser/notifications/ads_notification_handler.h",
|
||||
]
|
||||
}
|
||||
|
||||
if (is_android) {
|
||||
brave_browser_notifications_sources += [
|
||||
"//brave/browser/notifications/brave_notification_platform_bridge_helper_android.cc",
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "brave/browser/brave_rewards/rewards_service_factory.h"
|
||||
#include "brave/browser/perf/brave_perf_switches.h"
|
||||
#include "brave/components/ai_chat/core/common/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/public/prefs/pref_names.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_news/common/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_rewards/content/rewards_service.h"
|
||||
#include "brave/components/brave_shields/content/browser/ad_block_service.h"
|
||||
@@ -25,6 +25,10 @@
|
||||
#include "brave/components/ai_chat/core/common/pref_names.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
#include "brave/components/brave_ads/core/public/prefs/pref_names.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_NEWS)
|
||||
#include "brave/components/brave_news/common/pref_names.h"
|
||||
#endif
|
||||
@@ -68,9 +72,11 @@ void MaybeEnableBraveFeaturesPrefsForPerfTesting(Profile* profile) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
// Notification Ads
|
||||
profile->GetPrefs()->SetBoolean(brave_ads::prefs::kOptedInToNotificationAds,
|
||||
true);
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_NEWS)
|
||||
// Brave news
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "brave/browser/brave_rewards/rewards_service_factory.h"
|
||||
#include "brave/browser/perf/brave_perf_switches.h"
|
||||
#include "brave/components/ai_chat/core/common/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/public/prefs/pref_names.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_news/common/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_rewards/content/rewards_service.h"
|
||||
#include "brave/components/brave_rewards/content/rewards_service_observer.h"
|
||||
@@ -23,6 +23,10 @@
|
||||
#include "brave/components/ai_chat/core/browser/utils.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
#include "brave/components/brave_ads/core/public/prefs/pref_names.h"
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
#if BUILDFLAG(ENABLE_SPEEDREADER)
|
||||
#include "brave/browser/speedreader/speedreader_service_factory.h"
|
||||
#include "brave/components/speedreader/speedreader_service.h"
|
||||
@@ -80,10 +84,12 @@ class BraveSpeedFeatureProcessorBrowserTest : public InProcessBrowserTest {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
bool HasOptedInToNotificationAds() {
|
||||
return browser()->profile()->GetPrefs()->GetBoolean(
|
||||
brave_ads::prefs::kOptedInToNotificationAds);
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
void WaitForRewardsServiceInitialized() {
|
||||
auto* rewards_service = brave_rewards::RewardsServiceFactory::GetForProfile(
|
||||
@@ -101,7 +107,9 @@ IN_PROC_BROWSER_TEST_F(BraveSpeedFeatureProcessorBrowserTest, Default) {
|
||||
#if BUILDFLAG(ENABLE_SPEEDREADER)
|
||||
EXPECT_TRUE(SpeedreaderIsEnabled());
|
||||
#endif
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
EXPECT_TRUE(HasOptedInToNotificationAds());
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
#if BUILDFLAG(ENABLE_BRAVE_NEWS)
|
||||
EXPECT_TRUE(BraveNewsAreEnabled());
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
import("//brave/components/brave_ads/buildflags/buildflags.gni")
|
||||
import("//brave/components/brave_news/common/buildflags/buildflags.gni")
|
||||
import("//brave/components/speedreader/common/buildflags/buildflags.gni")
|
||||
|
||||
@@ -14,7 +15,7 @@ brave_browser_perf_sources = [
|
||||
|
||||
brave_browser_perf_deps = [
|
||||
"//base",
|
||||
"//brave/components/brave_ads/core",
|
||||
"//brave/components/brave_ads/buildflags",
|
||||
"//brave/components/brave_news/common/buildflags",
|
||||
"//brave/components/brave_rewards/content",
|
||||
"//brave/components/brave_shields/content/browser",
|
||||
@@ -23,6 +24,10 @@ brave_browser_perf_deps = [
|
||||
"//components/prefs",
|
||||
]
|
||||
|
||||
if (enable_brave_ads) {
|
||||
brave_browser_perf_deps += [ "//brave/components/brave_ads/core" ]
|
||||
}
|
||||
|
||||
if (enable_speedreader) {
|
||||
brave_browser_perf_deps += [ "//brave/components/speedreader" ]
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#include "base/check.h"
|
||||
#include "base/path_service.h"
|
||||
#include "brave/browser/brave_ads/ads_service_factory.h"
|
||||
#include "brave/browser/brave_rewards/rewards_service_factory.h"
|
||||
#include "brave/browser/misc_metrics/profile_misc_metrics_service_factory.h"
|
||||
#include "brave/browser/perf/brave_perf_features_processor.h"
|
||||
@@ -19,6 +18,7 @@
|
||||
#include "brave/browser/request_otr/request_otr_service_factory.h"
|
||||
#include "brave/browser/url_sanitizer/url_sanitizer_service_factory.h"
|
||||
#include "brave/components/ai_chat/core/common/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_shields/content/browser/brave_shields_util.h"
|
||||
#include "brave/components/brave_shields/core/browser/brave_shields_p3a.h"
|
||||
#include "brave/components/brave_shields/core/browser/brave_shields_utils.h"
|
||||
@@ -53,6 +53,10 @@
|
||||
#include "chrome/browser/user_education/user_education_service_factory.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
#include "brave/browser/brave_ads/ads_service_factory.h"
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_WALLET)
|
||||
#include "brave/browser/brave_wallet/brave_wallet_service_factory.h"
|
||||
#endif
|
||||
@@ -201,7 +205,9 @@ void BraveProfileManager::DoFinalInitForServices(Profile* profile,
|
||||
#endif
|
||||
|
||||
perf::MaybeEnableBraveFeaturesServicesAndComponentsForPerfTesting(profile);
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
brave_ads::AdsServiceFactory::GetForProfile(profile);
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
brave_rewards::RewardsServiceFactory::GetForProfile(profile);
|
||||
#if BUILDFLAG(ENABLE_BRAVE_WALLET)
|
||||
brave_wallet::BraveWalletServiceFactory::GetServiceForContext(profile);
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/functional/callback_helpers.h"
|
||||
#include "brave/browser/brave_ads/ads_service_factory.h"
|
||||
#include "brave/browser/brave_rewards/rewards_service_factory.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/constants/pref_names.h"
|
||||
#include "brave/components/tor/buildflags/buildflags.h"
|
||||
#include "brave/components/tor/tor_constants.h"
|
||||
@@ -30,6 +30,9 @@
|
||||
#include "chrome/test/base/ui_test_utils.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
#include "brave/browser/brave_ads/ads_service_factory.h"
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
class BraveProfileManagerTest : public PlatformBrowserTest {
|
||||
};
|
||||
@@ -56,8 +59,10 @@ IN_PROC_BROWSER_TEST_F(BraveProfileManagerTest,
|
||||
|
||||
EXPECT_EQ(brave_rewards::RewardsServiceFactory::GetForProfile(guest_profile),
|
||||
nullptr);
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
EXPECT_EQ(brave_ads::AdsServiceFactory::GetForProfile(guest_profile),
|
||||
nullptr);
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
ASSERT_TRUE(otr_profile->IsOffTheRecord());
|
||||
|
||||
@@ -66,8 +71,10 @@ IN_PROC_BROWSER_TEST_F(BraveProfileManagerTest,
|
||||
EXPECT_EQ(brave_rewards::RewardsServiceFactory::GetForProfile(otr_profile),
|
||||
nullptr);
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
EXPECT_NE(brave_ads::AdsServiceFactory::GetForProfile(profile), nullptr);
|
||||
EXPECT_EQ(brave_ads::AdsServiceFactory::GetForProfile(otr_profile), nullptr);
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import("//brave/browser/shell_integrations/buildflags/buildflags.gni")
|
||||
import("//brave/build/config.gni")
|
||||
import("//brave/components/ai_chat/core/common/buildflags/buildflags.gni")
|
||||
import("//brave/components/brave_ads/buildflags/buildflags.gni")
|
||||
import("//brave/components/brave_vpn/common/buildflags/buildflags.gni")
|
||||
import("//brave/components/brave_wallet/common/buildflags/buildflags.gni")
|
||||
import("//brave/components/brave_wayback_machine/buildflags/buildflags.gni")
|
||||
@@ -86,6 +87,7 @@ generate_grd("build_grd") {
|
||||
preprocess_if_expr("preprocess") {
|
||||
defines = [
|
||||
"enable_ai_chat=$enable_ai_chat",
|
||||
"enable_brave_ads=$enable_brave_ads",
|
||||
"enable_tor=$enable_tor",
|
||||
"enable_brave_wayback_machine=$enable_brave_wayback_machine",
|
||||
"enable_brave_vpn=$enable_brave_vpn",
|
||||
|
||||
@@ -79,13 +79,15 @@ RegisterPolymerTemplateModifications({
|
||||
saveButton.textContent = loadTimeData.getString('save')
|
||||
}
|
||||
|
||||
// Append clear Brave Ads data link
|
||||
const body = templateContent.querySelector('[slot="body"]')
|
||||
if (!body) {
|
||||
console.error(
|
||||
'[Settings] missing \'slot="body"\' in clear-browsing-data-dialog')
|
||||
return
|
||||
}
|
||||
|
||||
// <if expr="enable_brave_ads">
|
||||
// Append clear Brave Ads data link
|
||||
body.insertAdjacentHTML(
|
||||
'beforeend',
|
||||
getTrustedHTML`
|
||||
@@ -103,6 +105,7 @@ RegisterPolymerTemplateModifications({
|
||||
clearBraveAdsLink.textContent =
|
||||
loadTimeData.getString('clearBraveAdsData')
|
||||
}
|
||||
// </if>
|
||||
|
||||
// Append reset Brave Rewards data link
|
||||
body.insertAdjacentHTML(
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/time/time.h"
|
||||
#include "brave/components/brave_ads/core/public/prefs/pref_names.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_rewards/core/pref_names.h"
|
||||
#include "brave/components/brave_search_conversion/p3a.h"
|
||||
#include "brave/components/brave_search_conversion/utils.h"
|
||||
@@ -25,6 +25,10 @@
|
||||
#include "components/keyed_service/content/browser_context_dependency_manager.h"
|
||||
#include "components/pref_registry/pref_registry_syncable.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
#include "brave/components/brave_ads/core/public/prefs/pref_names.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
// Preference name for last switch report timestamp (new location in local
|
||||
@@ -219,11 +223,14 @@ SearchEngineTracker::SearchEngineTracker(
|
||||
kWebDiscoveryEnabled,
|
||||
base::BindRepeating(&SearchEngineTracker::RecordWebDiscoveryEnabledP3A,
|
||||
base::Unretained(this)));
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
pref_change_registrar_.Add(
|
||||
brave_ads::prefs::kOptedInToNotificationAds,
|
||||
base::BindRepeating(&SearchEngineTracker::RecordWebDiscoveryEnabledP3A,
|
||||
base::Unretained(this)));
|
||||
#endif
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
#endif // BUILDFLAG(ENABLE_EXTENSIONS) ||
|
||||
// BUILDFLAG(ENABLE_WEB_DISCOVERY_NATIVE)
|
||||
}
|
||||
|
||||
SearchEngineTracker::~SearchEngineTracker() = default;
|
||||
@@ -269,10 +276,12 @@ void SearchEngineTracker::OnTemplateURLServiceChanged() {
|
||||
void SearchEngineTracker::RecordWebDiscoveryEnabledP3A() {
|
||||
bool enabled = profile_prefs_->GetBoolean(kWebDiscoveryEnabled);
|
||||
UMA_HISTOGRAM_BOOLEAN(kWebDiscoveryEnabledMetric, enabled);
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
UMA_HISTOGRAM_BOOLEAN(
|
||||
kWebDiscoveryAndAdsMetric,
|
||||
enabled && profile_prefs_->GetBoolean(
|
||||
brave_ads::prefs::kOptedInToNotificationAds));
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
// Record web discovery default engine metric
|
||||
int answer = INT_MAX - 1;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/scoped_observation.h"
|
||||
#include "base/timer/wall_clock_timer.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/web_discovery/buildflags/buildflags.h"
|
||||
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
|
||||
#include "components/keyed_service/core/keyed_service.h"
|
||||
@@ -35,8 +36,10 @@ inline constexpr char kSwitchSearchEngineMetric[] =
|
||||
"Brave.Search.SwitchEngine.2";
|
||||
inline constexpr char kWebDiscoveryEnabledMetric[] =
|
||||
"Brave.Search.WebDiscoveryEnabled";
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
inline constexpr char kWebDiscoveryAndAdsMetric[] =
|
||||
"Brave.Search.WebDiscoveryAndAds";
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
inline constexpr char kWebDiscoveryDefaultEngineMetric[] =
|
||||
"Brave.Search.WebDiscoveryDefaultEngine";
|
||||
inline constexpr char kRewardsDefaultEngineMetric[] =
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "base/test/metrics/histogram_tester.h"
|
||||
#include "brave/browser/ui/browser_commands.h"
|
||||
#include "brave/components/brave_ads/core/public/prefs/pref_names.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_rewards/core/pref_names.h"
|
||||
#include "brave/components/constants/pref_names.h"
|
||||
#include "brave/components/search_engines/brave_prepopulated_engines.h"
|
||||
@@ -29,6 +29,10 @@
|
||||
#include "content/public/test/browser_test.h"
|
||||
#include "extensions/buildflags/buildflags.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
#include "brave/components/brave_ads/core/public/prefs/pref_names.h"
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
class SearchEngineProviderP3ATest : public InProcessBrowserTest {
|
||||
public:
|
||||
SearchEngineProviderP3ATest() {
|
||||
@@ -256,19 +260,25 @@ IN_PROC_BROWSER_TEST_F(SearchEngineProviderP3ATest, WebDiscoveryEnabledP3A) {
|
||||
histogram_tester_->ExpectBucketCount(kWebDiscoveryDefaultEngineMetric,
|
||||
SearchEngineP3A::kDuckDuckGo, 1);
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
histogram_tester_->ExpectUniqueSample(kWebDiscoveryAndAdsMetric, 0, 3);
|
||||
prefs->SetBoolean(brave_ads::prefs::kOptedInToNotificationAds, true);
|
||||
histogram_tester_->ExpectBucketCount(kWebDiscoveryAndAdsMetric, 1, 1);
|
||||
histogram_tester_->ExpectBucketCount(kWebDiscoveryDefaultEngineMetric,
|
||||
SearchEngineP3A::kDuckDuckGo, 2);
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
prefs->SetBoolean(kWebDiscoveryEnabled, false);
|
||||
histogram_tester_->ExpectBucketCount(kWebDiscoveryEnabledMetric, 0, 2);
|
||||
histogram_tester_->ExpectBucketCount(kWebDiscoveryDefaultEngineMetric,
|
||||
INT_MAX - 1, 2);
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
histogram_tester_->ExpectBucketCount(kWebDiscoveryAndAdsMetric, 0, 4);
|
||||
histogram_tester_->ExpectTotalCount(kWebDiscoveryAndAdsMetric, 5);
|
||||
histogram_tester_->ExpectTotalCount(kWebDiscoveryDefaultEngineMetric, 5);
|
||||
#else
|
||||
histogram_tester_->ExpectTotalCount(kWebDiscoveryDefaultEngineMetric, 4);
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
}
|
||||
#endif
|
||||
|
||||
+4
-2
@@ -816,7 +816,6 @@ source_set("ui") {
|
||||
"//brave/browser/brave_rewards:util",
|
||||
"//brave/browser/misc_metrics",
|
||||
"//brave/browser/shell_integrations/buildflags",
|
||||
"//brave/browser/ui/brave_ads",
|
||||
"//brave/browser/ui/brave_tooltips",
|
||||
|
||||
# //chrome/browser/ui depends on //brave/browser/ui, add this target here
|
||||
@@ -1009,11 +1008,14 @@ source_set("ui") {
|
||||
]
|
||||
|
||||
deps += [
|
||||
"//brave/browser/ui/views/brave_ads",
|
||||
"//brave/browser/ui/views/brave_tooltips",
|
||||
"//brave/browser/ui/views/page_info",
|
||||
"//ui/views/controls/webview",
|
||||
]
|
||||
|
||||
if (enable_brave_ads) {
|
||||
deps += [ "//brave/browser/ui/views/brave_ads" ]
|
||||
}
|
||||
}
|
||||
|
||||
if (enable_text_recognition) {
|
||||
|
||||
@@ -4,13 +4,14 @@
|
||||
# You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
import("//brave/components/ai_chat/core/common/buildflags/buildflags.gni")
|
||||
import("//brave/components/brave_ads/buildflags/buildflags.gni")
|
||||
import("//brave/components/brave_news/common/buildflags/buildflags.gni")
|
||||
import("//brave/components/containers/buildflags/buildflags.gni")
|
||||
import("//brave/components/speedreader/common/buildflags/buildflags.gni")
|
||||
import("//build/config/ui.gni")
|
||||
|
||||
brave_ui_allow_circular_includes_from =
|
||||
[ "//brave/browser/ui/webui/ads_internals" ]
|
||||
brave_ui_allow_circular_includes_from = []
|
||||
|
||||
if (enable_ai_chat) {
|
||||
brave_ui_allow_circular_includes_from +=
|
||||
[ "//brave/browser/ui/webui/ai_chat" ]
|
||||
@@ -63,6 +64,11 @@ if (toolkit_views) {
|
||||
}
|
||||
}
|
||||
|
||||
if (enable_brave_ads) {
|
||||
brave_ui_allow_circular_includes_from +=
|
||||
[ "//brave/browser/ui/webui/ads_internals" ]
|
||||
}
|
||||
|
||||
if (enable_speedreader) {
|
||||
brave_ui_allow_circular_includes_from += [ "//brave/browser/ui/speedreader" ]
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "brave/components/brave_adaptive_captcha/brave_adaptive_captcha_service.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/browser/service/ads_service.h"
|
||||
#include "brave/components/brave_ads/core/mojom/brave_ads.mojom.h"
|
||||
#include "brave/components/brave_rewards/content/rewards_p3a.h"
|
||||
#include "brave/components/brave_rewards/content/rewards_service.h"
|
||||
#include "brave/components/brave_rewards/content/rewards_service_observer.h"
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "brave/components/brave_ads/core/mojom/brave_ads.mojom-forward.h"
|
||||
#include "brave/components/brave_rewards/core/mojom/rewards_page.mojom.h"
|
||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||
#include "mojo/public/cpp/bindings/pending_remote.h"
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "brave/browser/brave_browser_features.h"
|
||||
#include "brave/browser/brave_rewards/rewards_util.h"
|
||||
#include "brave/browser/ntp_background/view_counter_service_factory.h"
|
||||
#include "brave/browser/ui/webui/ads_internals/ads_internals_ui.h"
|
||||
#include "brave/browser/ui/webui/brave_rewards/rewards_page_ui.h"
|
||||
#include "brave/browser/ui/webui/brave_rewards/rewards_web_ui_utils.h"
|
||||
#include "brave/browser/ui/webui/brave_rewards_internals_ui.h"
|
||||
@@ -77,6 +76,7 @@
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
#include "brave/browser/brave_ads/ads_service_factory.h"
|
||||
#include "brave/browser/ui/webui/ads_internals/ads_internals_ui.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_WALLET)
|
||||
@@ -110,13 +110,15 @@ WebUIController* NewWebUI(WebUI* web_ui, const GURL& url) {
|
||||
Profile* profile = Profile::FromBrowserContext(
|
||||
web_ui->GetWebContents()->GetBrowserContext());
|
||||
CHECK(profile);
|
||||
if (host == kAdsInternalsHost) {
|
||||
if (host == kSkusInternalsHost) {
|
||||
return new SkusInternalsUI(web_ui, url.host());
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
} else if (host == kAdsInternalsHost) {
|
||||
return new AdsInternalsUI(
|
||||
web_ui, url.host(),
|
||||
brave_ads::AdsServiceFactory::GetForProfile(profile),
|
||||
*profile->GetPrefs());
|
||||
} else if (host == kSkusInternalsHost) {
|
||||
return new SkusInternalsUI(web_ui, url.host());
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
} else if (host == kRewardsPageHost &&
|
||||
// We don't want to check for supported profile type here because
|
||||
// we want private windows to redirect to the regular profile.
|
||||
@@ -232,8 +234,11 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
|
||||
(url.host() == kRewriterUIHost &&
|
||||
ai_rewriter::features::IsAIRewriterEnabled()) ||
|
||||
#endif
|
||||
url.host() == kRewardsPageHost || url.host() == kRewardsInternalsHost ||
|
||||
(url.host() == kAdsInternalsHost && !profile->IsIncognitoProfile())) {
|
||||
url.host() == kRewardsPageHost || url.host() == kRewardsInternalsHost
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|| (url.host() == kAdsInternalsHost && !profile->IsIncognitoProfile())
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
) {
|
||||
return &NewWebUI;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,12 +9,15 @@
|
||||
#include "base/check_op.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/functional/callback_helpers.h"
|
||||
#include "brave/browser/brave_ads/ads_service_factory.h"
|
||||
#include "brave/components/brave_ads/core/browser/service/ads_service.h"
|
||||
#include "brave/components/brave_rewards/core/pref_names.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
#include "brave/browser/brave_ads/ads_service_factory.h"
|
||||
#include "brave/components/brave_ads/core/browser/service/ads_service.h"
|
||||
#endif
|
||||
|
||||
namespace settings {
|
||||
|
||||
BraveClearBrowsingDataHandler::BraveClearBrowsingDataHandler(
|
||||
@@ -41,11 +44,13 @@ void BraveClearBrowsingDataHandler::RegisterMessages() {
|
||||
base::BindRepeating(
|
||||
&BraveClearBrowsingDataHandler::HandleGetBraveRewardsEnabled,
|
||||
base::Unretained(this)));
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
web_ui()->RegisterMessageCallback(
|
||||
"clearBraveAdsData",
|
||||
base::BindRepeating(
|
||||
&BraveClearBrowsingDataHandler::HandleClearBraveAdsData,
|
||||
base::Unretained(this)));
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
}
|
||||
|
||||
void BraveClearBrowsingDataHandler::HandleGetBraveRewardsEnabled(
|
||||
@@ -59,6 +64,7 @@ void BraveClearBrowsingDataHandler::HandleGetBraveRewardsEnabled(
|
||||
ResolveJavascriptCallback(args[0], rewards_enabled);
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
void BraveClearBrowsingDataHandler::HandleClearBraveAdsData(
|
||||
const base::Value::List& /*args*/) {
|
||||
if (auto* ads_service =
|
||||
@@ -66,6 +72,7 @@ void BraveClearBrowsingDataHandler::HandleClearBraveAdsData(
|
||||
ads_service->ClearData(/*intentional*/ base::DoNothing());
|
||||
}
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
void BraveClearBrowsingDataHandler::OnRewardsEnabledPreferenceChanged() {
|
||||
if (!IsJavascriptAllowed()) {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#define BRAVE_BROWSER_UI_WEBUI_SETTINGS_BRAVE_CLEAR_BROWSING_DATA_HANDLER_H_
|
||||
|
||||
#include "base/values.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.h"
|
||||
#include "components/prefs/pref_change_registrar.h"
|
||||
|
||||
@@ -28,7 +29,9 @@ class BraveClearBrowsingDataHandler : public ClearBrowsingDataHandler {
|
||||
|
||||
void HandleGetBraveRewardsEnabled(const base::Value::List& args);
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
void HandleClearBraveAdsData(const base::Value::List& args);
|
||||
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
||||
|
||||
void OnRewardsEnabledPreferenceChanged();
|
||||
|
||||
|
||||
@@ -11,8 +11,11 @@
|
||||
#include "base/feature_list.h"
|
||||
#include "base/metrics/field_trial_params.h"
|
||||
#include "brave/components/brave_ads/browser/ad_units/notification_ad/custom_notification_ad_constants.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "build/build_config.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
BASE_DECLARE_FEATURE(kCustomNotificationAdFeature);
|
||||
|
||||
@@ -17,8 +17,11 @@
|
||||
#include "brave/components/brave_ads/browser/component_updater/resource_component_registrar.h"
|
||||
#include "brave/components/brave_ads/browser/component_updater/resource_component_registrar_delegate.h"
|
||||
#include "brave/components/brave_ads/browser/component_updater/resource_info.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_component_updater/browser/brave_component.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
class ResourceComponent final : public ResourceComponentRegistrarDelegate {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
import("//brave/components/brave_origin/buildflags/buildflags.gni")
|
||||
|
||||
declare_args() {
|
||||
# Set `enable_brave_ads=!is_brave_origin_branded` once all PRs migrating
|
||||
# Brave Ads code under ENABLE_BRAVE_ADS build flag have landed.
|
||||
enable_brave_ads = true
|
||||
enable_brave_ads = !is_brave_origin_branded
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ source_set("internals") {
|
||||
|
||||
public_deps = [
|
||||
"//base",
|
||||
"//brave/components/brave_ads/buildflags",
|
||||
"//brave/components/brave_rewards/core",
|
||||
"//brave/components/services/bat_ads/public/interfaces",
|
||||
"//components/prefs",
|
||||
|
||||
@@ -11,12 +11,15 @@
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/values.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/browser/service/ads_service_callback.h"
|
||||
#include "brave/components/services/bat_ads/public/interfaces/bat_ads.mojom.h"
|
||||
#include "components/prefs/pref_change_registrar.h"
|
||||
#include "mojo/public/cpp/bindings/receiver.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
class PrefService;
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
@@ -30,6 +30,7 @@ source_set("network") {
|
||||
]
|
||||
|
||||
deps = [
|
||||
"//brave/components/brave_ads/buildflags",
|
||||
"//brave/components/brave_ads/core/public:headers",
|
||||
"//components/prefs",
|
||||
"//mojo/public/cpp/bindings",
|
||||
|
||||
@@ -13,11 +13,14 @@
|
||||
#include "base/memory/raw_ref.h"
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/browser/network/network_client_callback.h"
|
||||
#include "brave/components/brave_ads/core/mojom/brave_ads.mojom-forward.h"
|
||||
#include "services/network/public/cpp/network_context_getter.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
class PrefService;
|
||||
|
||||
namespace network {
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
# The target provides the AdsService interface and related types without
|
||||
# depending on Brave Ads implementation targets, allowing it to be used even
|
||||
# when Brave Ads is disabled by build flag.
|
||||
source_set("service") {
|
||||
sources = [
|
||||
"ads_service.cc",
|
||||
|
||||
@@ -25,6 +25,12 @@ class GURL;
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
// AdsService is the key interface for the Brave Ads component, managing ad
|
||||
// serving, user interactions, and ad-related events. It handles all ad types
|
||||
// including notification ads, new tab page ads, and search result ads.
|
||||
// Note: This header can be included even when Brave Ads is disabled by build
|
||||
// flag. When Brave Ads is disabled, the pointer to AdsService should be
|
||||
// nullptr and no ads functionality should be available.
|
||||
class AdsService : public KeyedService {
|
||||
public:
|
||||
class Delegate {
|
||||
|
||||
@@ -19,6 +19,7 @@ source_set("virtual_pref") {
|
||||
|
||||
deps = [
|
||||
"//base/version_info",
|
||||
"//brave/components/brave_ads/buildflags",
|
||||
"//brave/components/brave_ads/core/public:headers",
|
||||
"//brave/components/ntp_background_images/common",
|
||||
"//brave/components/skus/browser",
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/values.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
class PrefService;
|
||||
|
||||
|
||||
@@ -55,11 +55,16 @@ source_set("headers") {
|
||||
"//url",
|
||||
]
|
||||
|
||||
public_deps = [ "//brave/components/brave_ads/core/mojom" ]
|
||||
public_deps = [
|
||||
"//brave/components/brave_ads/buildflags",
|
||||
"//brave/components/brave_ads/core/mojom",
|
||||
]
|
||||
}
|
||||
|
||||
source_set("test_support") {
|
||||
testonly = true
|
||||
|
||||
sources = [ "common/locale/scoped_locale_for_testing.h" ]
|
||||
|
||||
deps = [ "//brave/components/brave_ads/buildflags" ]
|
||||
}
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
|
||||
#include <string_view>
|
||||
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/mojom/brave_ads.mojom-forward.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
// Returns a `mojom::ConfirmationType` value based on the string input.
|
||||
|
||||
@@ -8,9 +8,12 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/mojom/brave_ads.mojom.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
struct AdInfo {
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
|
||||
#include <string_view>
|
||||
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/mojom/brave_ads.mojom-forward.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
// Returns a `mojom::AdType` value based on the string input.
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
#ifndef BRAVE_COMPONENTS_BRAVE_ADS_CORE_PUBLIC_AD_UNITS_NEW_TAB_PAGE_AD_NEW_TAB_PAGE_AD_CONSTANTS_H_
|
||||
#define BRAVE_COMPONENTS_BRAVE_ADS_CORE_PUBLIC_AD_UNITS_NEW_TAB_PAGE_AD_NEW_TAB_PAGE_AD_CONSTANTS_H_
|
||||
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
inline constexpr char kNewTabPageAdTypeKey[] = "type";
|
||||
|
||||
+3
@@ -9,8 +9,11 @@
|
||||
#include <optional>
|
||||
#include <string_view>
|
||||
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/mojom/brave_ads.mojom-forward.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
std::optional<mojom::NewTabPageAdEventType> ToMojomNewTabPageAdEventType(
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
|
||||
#include "base/feature_list.h"
|
||||
#include "base/metrics/field_trial_params.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace base {
|
||||
class TimeDelta;
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/public/ad_units/ad_info.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
struct NewTabPageAdInfo final : AdInfo {
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
|
||||
#include "base/memory/raw_ref.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/mojom/brave_ads.mojom.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
class AdsService;
|
||||
|
||||
@@ -9,8 +9,11 @@
|
||||
#include <optional>
|
||||
|
||||
#include "base/types/optional_ref.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/mojom/brave_ads.mojom-forward.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
struct NewTabPageAdInfo;
|
||||
|
||||
@@ -9,8 +9,11 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include "base/time/time.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "build/build_config.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
inline constexpr char kNotificationAdTypeKey[] = "type";
|
||||
|
||||
@@ -9,8 +9,11 @@
|
||||
#include "base/feature_list.h"
|
||||
#include "base/metrics/field_trial_params.h"
|
||||
#include "base/time/time.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/public/ad_units/notification_ad/notification_ad_constants.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
BASE_DECLARE_FEATURE(kNotificationAdFeature);
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/public/ad_units/ad_info.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
struct NotificationAdInfo final : AdInfo {
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
|
||||
#include "base/containers/circular_deque.h"
|
||||
#include "base/values.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
|
||||
#include "base/feature_list.h"
|
||||
#include "base/metrics/field_trial_params.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
|
||||
@@ -10,10 +10,13 @@
|
||||
#include <string>
|
||||
|
||||
#include "base/values.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/mojom/brave_ads.mojom-forward.h"
|
||||
#include "brave/components/brave_ads/core/public/ads_callback.h"
|
||||
#include "brave/components/brave_ads/core/public/ads_observer.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace base {
|
||||
class Time;
|
||||
} // namespace base
|
||||
|
||||
@@ -11,11 +11,14 @@
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/types/optional_ref.h"
|
||||
#include "base/values.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/mojom/brave_ads.mojom-forward.h"
|
||||
#include "brave/components/brave_ads/core/public/ad_units/new_tab_page_ad/new_tab_page_ad_info.h"
|
||||
#include "brave/components/brave_ads/core/public/ad_units/notification_ad/notification_ad_info.h"
|
||||
#include "brave/components/brave_ads/core/public/history/ad_history_item_info.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
using ResultCallback = base::OnceCallback<void(bool success)>;
|
||||
|
||||
@@ -10,9 +10,12 @@
|
||||
#include <string>
|
||||
|
||||
#include "base/values.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/mojom/brave_ads.mojom-forward.h"
|
||||
#include "brave/components/brave_ads/core/public/ads_client/ads_client_callback.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
class AdsClientNotifierObserver;
|
||||
|
||||
@@ -11,9 +11,12 @@
|
||||
|
||||
#include "base/files/file.h"
|
||||
#include "base/functional/callback.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/mojom/brave_ads.mojom-forward.h"
|
||||
#include "brave/components/brave_ads/core/public/history/site_history.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
using SaveCallback = base::OnceCallback<void(bool success)>;
|
||||
|
||||
@@ -13,9 +13,12 @@
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/observer_list.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/public/ads_client/ads_client_notifier_interface.h"
|
||||
#include "brave/components/brave_ads/core/public/ads_client/ads_client_notifier_observer.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
class GURL;
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
class GURL;
|
||||
|
||||
namespace base {
|
||||
|
||||
@@ -12,8 +12,11 @@
|
||||
|
||||
#include "base/observer_list_types.h"
|
||||
#include "base/time/time.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
class AdsClientNotifierObserver : public base::CheckedObserver {
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
#ifndef BRAVE_COMPONENTS_BRAVE_ADS_CORE_PUBLIC_ADS_CONSTANTS_H_
|
||||
#define BRAVE_COMPONENTS_BRAVE_ADS_CORE_PUBLIC_ADS_CONSTANTS_H_
|
||||
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
inline constexpr char kTraceEventCategory[] = "brave.ads";
|
||||
|
||||
@@ -6,8 +6,11 @@
|
||||
#ifndef BRAVE_COMPONENTS_BRAVE_ADS_CORE_PUBLIC_ADS_OBSERVER_H_
|
||||
#define BRAVE_COMPONENTS_BRAVE_ADS_CORE_PUBLIC_ADS_OBSERVER_H_
|
||||
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/mojom/brave_ads.mojom-forward.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
class AdsObserver {
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
#ifndef BRAVE_COMPONENTS_BRAVE_ADS_CORE_PUBLIC_ADS_UTIL_H_
|
||||
#define BRAVE_COMPONENTS_BRAVE_ADS_CORE_PUBLIC_ADS_UTIL_H_
|
||||
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
// Determines whether ads are supported in the user's region, returning `true`
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
|
||||
#include "base/containers/queue.h"
|
||||
#include "base/functional/callback.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
inline constexpr char kDefaultLanguageCode[] = "en";
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads::test {
|
||||
|
||||
// Set the current language code for testing, restoring the original language
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
class GURL;
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
@@ -6,8 +6,11 @@
|
||||
#ifndef BRAVE_COMPONENTS_BRAVE_ADS_CORE_PUBLIC_FLAGS_FLAGS_UTIL_H_
|
||||
#define BRAVE_COMPONENTS_BRAVE_ADS_CORE_PUBLIC_FLAGS_FLAGS_UTIL_H_
|
||||
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/mojom/brave_ads.mojom-forward.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
// Builds Flags basing on command line arguments and environment.
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
#include "base/feature_list.h"
|
||||
#include "base/metrics/field_trial_params.h"
|
||||
#include "base/time/time.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
|
||||
@@ -10,9 +10,12 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/time/time.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/mojom/brave_ads.mojom.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
struct AdHistoryItemInfo final {
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
#define BRAVE_COMPONENTS_BRAVE_ADS_CORE_PUBLIC_HISTORY_AD_HISTORY_ITEM_VALUE_UTIL_H_
|
||||
|
||||
#include "base/values.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
using SiteHistoryList = std::vector<GURL>;
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
#ifndef BRAVE_COMPONENTS_BRAVE_ADS_CORE_PUBLIC_PREFS_OBSOLETE_PREF_UTIL_H_
|
||||
#define BRAVE_COMPONENTS_BRAVE_ADS_CORE_PUBLIC_PREFS_OBSOLETE_PREF_UTIL_H_
|
||||
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
class PrefRegistrySimple;
|
||||
class PrefService;
|
||||
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
#ifndef BRAVE_COMPONENTS_BRAVE_ADS_CORE_PUBLIC_PREFS_PREF_NAMES_H_
|
||||
#define BRAVE_COMPONENTS_BRAVE_ADS_CORE_PUBLIC_PREFS_PREF_NAMES_H_
|
||||
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads::prefs {
|
||||
|
||||
// IMPORTANT: Prefs that need clearing should be prefixed with
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
#ifndef BRAVE_COMPONENTS_BRAVE_ADS_CORE_PUBLIC_PREFS_PREF_REGISTRY_H_
|
||||
#define BRAVE_COMPONENTS_BRAVE_ADS_CORE_PUBLIC_PREFS_PREF_REGISTRY_H_
|
||||
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
class PrefRegistrySimple;
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
+3
@@ -11,6 +11,9 @@
|
||||
|
||||
#include "base/containers/flat_map.h"
|
||||
#include "base/values.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
|
||||
+3
@@ -8,6 +8,9 @@
|
||||
|
||||
#include "base/feature_list.h"
|
||||
#include "base/metrics/field_trial_params.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace base {
|
||||
class TimeDelta;
|
||||
|
||||
@@ -6,9 +6,12 @@
|
||||
#ifndef BRAVE_COMPONENTS_BRAVE_ADS_CORE_PUBLIC_USER_ENGAGEMENT_REACTIONS_REACTIONS_UTIL_H_
|
||||
#define BRAVE_COMPONENTS_BRAVE_ADS_CORE_PUBLIC_USER_ENGAGEMENT_REACTIONS_REACTIONS_UTIL_H_
|
||||
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
#include "brave/components/brave_ads/core/mojom/brave_ads.mojom-forward.h"
|
||||
#include "brave/components/brave_ads/core/public/history/ad_history_item_info.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace brave_ads {
|
||||
|
||||
struct AdHistoryItemInfo;
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
|
||||
#include "base/feature_list.h"
|
||||
#include "base/metrics/field_trial_params.h"
|
||||
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
||||
|
||||
static_assert(BUILDFLAG(ENABLE_BRAVE_ADS));
|
||||
|
||||
namespace base {
|
||||
class TimeDelta;
|
||||
|
||||
@@ -73,7 +73,6 @@ static_library("browser") {
|
||||
"//base",
|
||||
"//brave/brave_domains",
|
||||
"//brave/components/api_request_helper",
|
||||
"//brave/components/brave_ads/browser",
|
||||
"//brave/components/brave_news/api",
|
||||
"//brave/components/brave_private_cdn",
|
||||
"//brave/components/brave_rewards/core",
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "base/task/thread_pool.h"
|
||||
#include "base/time/time.h"
|
||||
#include "base/values.h"
|
||||
#include "brave/components/brave_ads/core/browser/service/ads_service.h"
|
||||
#include "brave/components/brave_news/browser/background_history_querier.h"
|
||||
#include "brave/components/brave_news/browser/brave_news_engine.h"
|
||||
#include "brave/components/brave_news/browser/brave_news_p3a.h"
|
||||
@@ -97,11 +96,10 @@ mojo::StructPtr<EventType> CreateChangeEvent(
|
||||
|
||||
BraveNewsController::BraveNewsController(
|
||||
PrefService* prefs,
|
||||
brave_ads::AdsService* ads_service,
|
||||
history::HistoryService* history_service,
|
||||
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||
std::unique_ptr<DirectFeedFetcher::Delegate> direct_feed_fetcher_delegate)
|
||||
: ads_service_(ads_service),
|
||||
:
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
private_cdn_request_helper_(GetNetworkTrafficAnnotationTag(),
|
||||
url_loader_factory),
|
||||
|
||||
@@ -40,10 +40,6 @@ static_assert(BUILDFLAG(ENABLE_BRAVE_NEWS));
|
||||
|
||||
class PrefService;
|
||||
|
||||
namespace brave_ads {
|
||||
class AdsService;
|
||||
} // namespace brave_ads
|
||||
|
||||
namespace history {
|
||||
class HistoryService;
|
||||
} // namespace history
|
||||
@@ -63,7 +59,6 @@ class BraveNewsController
|
||||
public:
|
||||
BraveNewsController(
|
||||
PrefService* prefs,
|
||||
brave_ads::AdsService* ads_service,
|
||||
history::HistoryService* history_service,
|
||||
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
||||
std::unique_ptr<DirectFeedFetcher::Delegate>
|
||||
@@ -173,8 +168,6 @@ class BraveNewsController
|
||||
|
||||
BackgroundHistoryQuerier MakeHistoryQuerier();
|
||||
|
||||
raw_ptr<brave_ads::AdsService> ads_service_ = nullptr;
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
// Note: This is only used by Android, to load padded images from the Private
|
||||
// CDN.
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import("//brave/components/ai_chat/core/common/buildflags/buildflags.gni")
|
||||
import("//brave/components/ai_rewriter/common/buildflags/buildflags.gni")
|
||||
import("//brave/components/brave_ads/buildflags/buildflags.gni")
|
||||
import("//brave/components/brave_news/common/buildflags/buildflags.gni")
|
||||
import("//brave/components/brave_vpn/common/buildflags/buildflags.gni")
|
||||
import("//brave/components/brave_wallet/common/buildflags/buildflags.gni")
|
||||
@@ -68,18 +69,22 @@ repack("resources") {
|
||||
":static_resources",
|
||||
"//brave/components/ai_rewriter/common/buildflags",
|
||||
"//brave/components/brave_account/resources",
|
||||
"//brave/components/brave_ads/browser/resources:generated_resources",
|
||||
"//brave/components/cosmetic_filters/resources/data:generated_resources",
|
||||
"//brave/components/skus/browser/resources:generated_resources",
|
||||
]
|
||||
sources = [
|
||||
"$root_gen_dir/brave/components/brave_account/resources/brave_account_resources.pak",
|
||||
"$root_gen_dir/brave/components/brave_ads/browser/resources/ads_internals_generated.pak",
|
||||
"$root_gen_dir/brave/components/cosmetic_filters/resources/cosmetic_filters_generated.pak",
|
||||
"$root_gen_dir/brave/components/skus/browser/resources/skus_internals_generated.pak",
|
||||
"$root_gen_dir/components/brave_components_static.pak",
|
||||
]
|
||||
|
||||
if (enable_brave_ads) {
|
||||
deps +=
|
||||
[ "//brave/components/brave_ads/browser/resources:generated_resources" ]
|
||||
sources += [ "$root_gen_dir/brave/components/brave_ads/browser/resources/ads_internals_generated.pak" ]
|
||||
}
|
||||
|
||||
if (enable_brave_wallet) {
|
||||
deps += [ "//brave/components/brave_wallet_ui:resources" ]
|
||||
sources += [
|
||||
|
||||
+6
-2
@@ -134,13 +134,11 @@ test("brave_unit_tests") {
|
||||
"//brave/components/ntp_background_images/browser/ntp_background_images_source_unittest.cc",
|
||||
"//brave/components/ntp_background_images/browser/ntp_sponsored_image_source_unittest.cc",
|
||||
"//brave/components/ntp_background_images/browser/ntp_sponsored_images_data_unittest.cc",
|
||||
"//brave/components/ntp_background_images/browser/ntp_sponsored_rich_media_ad_event_handler_unittest.cc",
|
||||
"//brave/components/ntp_background_images/browser/ntp_sponsored_rich_media_source_unittest.cc",
|
||||
"//brave/components/ntp_background_images/browser/ntp_sponsored_source_test_util.cc",
|
||||
"//brave/components/ntp_background_images/browser/ntp_sponsored_source_test_util.h",
|
||||
"//brave/components/ntp_background_images/browser/ntp_sponsored_source_util_unittest.cc",
|
||||
"//brave/components/ntp_background_images/browser/view_counter_model_unittest.cc",
|
||||
"//brave/components/ntp_background_images/browser/view_counter_service_unittest.cc",
|
||||
"//brave/components/time_period_storage/daily_storage_unittest.cc",
|
||||
"//brave/components/time_period_storage/time_period_storage_unittest.cc",
|
||||
"//brave/components/time_period_storage/weekly_event_storage_unittest.cc",
|
||||
@@ -383,6 +381,11 @@ test("brave_unit_tests") {
|
||||
}
|
||||
|
||||
if (enable_brave_ads) {
|
||||
sources += [
|
||||
"//brave/components/ntp_background_images/browser/ntp_sponsored_rich_media_ad_event_handler_unittest.cc",
|
||||
"//brave/components/ntp_background_images/browser/view_counter_service_unittest.cc",
|
||||
]
|
||||
|
||||
deps += [
|
||||
"//brave/browser/brave_ads",
|
||||
"//brave/browser/brave_ads/device_id:unit_tests",
|
||||
@@ -918,6 +921,7 @@ test("brave_browser_tests") {
|
||||
"//brave/components/brave_perf_predictor/browser",
|
||||
"//brave/components/brave_perf_predictor/common",
|
||||
"//brave/components/brave_referrals/browser",
|
||||
"//brave/components/brave_rewards/core",
|
||||
]
|
||||
|
||||
if (enable_brave_news) {
|
||||
|
||||
@@ -10,8 +10,6 @@ include_rules += [
|
||||
"+brave/grit",
|
||||
"+chrome/utility",
|
||||
"+brave/components/constants",
|
||||
"+brave/components/constants",
|
||||
"+brave/components/services/bat_ads",
|
||||
"+brave/components/services/bat_rewards",
|
||||
"+brave/components/services/brave_wallet",
|
||||
"+brave/components/brave_wallet/common/buildflags",
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include "brave/components/brave_wallet/common/buildflags/buildflags.h"
|
||||
#include "brave/components/services/bat_ads/bat_ads_service_impl.h"
|
||||
#include "brave/components/services/bat_ads/public/interfaces/bat_ads.mojom.h"
|
||||
#include "brave/components/services/bat_rewards/public/interfaces/rewards_engine_factory.mojom.h"
|
||||
#include "brave/components/services/bat_rewards/rewards_engine_factory.h"
|
||||
#include "brave/components/tor/buildflags/buildflags.h"
|
||||
@@ -52,11 +50,6 @@ auto RunRewardsEngineFactory(
|
||||
std::move(receiver));
|
||||
}
|
||||
|
||||
auto RunBatAdsService(
|
||||
mojo::PendingReceiver<bat_ads::mojom::BatAdsService> receiver) {
|
||||
return std::make_unique<bat_ads::BatAdsServiceImpl>(std::move(receiver));
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_WALLET)
|
||||
auto RunBraveWalletUtilsService(
|
||||
mojo::PendingReceiver<brave_wallet::mojom::BraveWalletUtilsService>
|
||||
@@ -83,8 +76,6 @@ void BraveContentUtilityClient::RegisterMainThreadServices(
|
||||
|
||||
services.Add(RunRewardsEngineFactory);
|
||||
|
||||
services.Add(RunBatAdsService);
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_WALLET)
|
||||
services.Add(RunBraveWalletUtilsService);
|
||||
#endif
|
||||
|
||||
@@ -7,10 +7,8 @@ import("//brave/components/tor/buildflags/buildflags.gni")
|
||||
|
||||
brave_utility_importer_sources = []
|
||||
brave_utility_importer_deps = []
|
||||
brave_utility_importer_public_deps = [
|
||||
"//brave/components/services/bat_ads:lib",
|
||||
"//brave/components/services/bat_rewards:lib",
|
||||
]
|
||||
brave_utility_importer_public_deps =
|
||||
[ "//brave/components/services/bat_rewards:lib" ]
|
||||
|
||||
if (!is_android) {
|
||||
brave_utility_importer_sources += [
|
||||
|
||||
@@ -16,8 +16,6 @@ brave_utility_sources += brave_utility_importer_sources
|
||||
|
||||
brave_utility_deps = [
|
||||
"//brave/components/brave_wallet/common/buildflags",
|
||||
"//brave/components/services/bat_ads:lib",
|
||||
"//brave/components/services/bat_ads/public/interfaces",
|
||||
"//brave/components/services/bat_rewards:lib",
|
||||
"//brave/components/services/bat_rewards/public/interfaces",
|
||||
"//brave/components/tor/buildflags",
|
||||
|
||||
Reference in New Issue
Block a user