Skip to content

Commit

Permalink
Merge pull request #17472 from /issues/13793
Browse files Browse the repository at this point in the history
Moved bat-native-ads to components
  • Loading branch information
aseren authored Mar 12, 2023
2 parents 96d3a7f + 6adfa06 commit 97e803b
Show file tree
Hide file tree
Showing 2,545 changed files with 28,326 additions and 28,632 deletions.
15 changes: 6 additions & 9 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,12 @@ components/brave_ads/**/*.mm @brave/ads-client
components/services/bat_ads/**/*.cc @brave/ads-client
components/services/bat_ads/**/*.h @brave/ads-client
components/services/bat_ads/**/*.mm @brave/ads-client
vendor/bat-native-ads/**/*.cc @brave/ads-client
vendor/bat-native-ads/**/*.h @brave/ads-client
vendor/bat-native-ads/**/*.mm @brave/ads-client
vendor/bat-native-ads/src/bat/ads/internal/privacy/**/*.cc @brave/ads-client
vendor/bat-native-ads/src/bat/ads/internal/privacy/**/*.h @brave/ads-client
vendor/bat-native-ads/src/bat/ads/internal/privacy/**/*.mm @brave/ads-client
vendor/bat-native-ads/src/bat/ads/internal/security/**/*.cc @brave/ads-client
vendor/bat-native-ads/src/bat/ads/internal/security/**/*.h @brave/ads-client
vendor/bat-native-ads/src/bat/ads/internal/security/**/*.mm @brave/ads-client
brave/components/brave_ads/core/internal/privacy/**/*.cc @brave/ads-client
brave/components/brave_ads/core/internal/privacy/**/*.h @brave/ads-client
brave/components/brave_ads/core/internal/privacy/**/*.mm @brave/ads-client
brave/components/brave_ads/core/internal/security/**/*.cc @brave/ads-client
brave/components/brave_ads/core/internal/security/**/*.h @brave/ads-client
brave/components/brave_ads/core/internal/security/**/*.mm @brave/ads-client

# Network
browser/net/ @iefremov
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.cache/clangd
/vendor/*
!/vendor/bat-native-ledger
!/vendor/bat-native-ads
.DS_Store
.brave_gclient_*
.gclient_*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private static void appendBraveSwitchesAndArguments() {
if (sharedPreferences.getBoolean(PREF_QA_VLOG_REWARDS, false)) {
qaCommandLine += " --enable-logging=stderr";
qaCommandLine +=
" --vmodule=*/bat-native-ads/*=6,*/brave_ads/*=6,*/brave_user_model/*=6,*/bat_ads/*=6,*/bat-native-ledger/*=6,*/brave_rewards/*=6";
" --vmodule=*/brave_ads/*=6,*/brave_user_model/*=6,*/bat_ads/*=6,*/bat-native-ledger/*=6,*/brave_rewards/*=6";
}

// For testing we need custom variations server url prior to the first time run, so we try
Expand Down
1 change: 0 additions & 1 deletion browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ group("browser") {
"//brave/vendor/bat-native-ledger:headers",

# these are layering violation and need to be fixed
"//brave/components/brave_ads/test:brave_ads_unit_tests",
"//brave/components/brave_rewards/browser:testutil",
"//brave/components/brave_rewards/test:brave_rewards_unit_tests",
"//brave/components/ipfs/test:*",
Expand Down
2 changes: 0 additions & 2 deletions browser/brave_ads/DEPS
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
include_rules = [
"+bat/ledger",
"-bat/ledger/internal",
"+bat/ads",
"-bat/ads/internal",
]
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/test/scoped_feature_list.h"
#include "bat/ads/public/interfaces/ads.mojom.h"
#include "brave/browser/brave_ads/search_result_ad/search_result_ad_tab_helper.h"
#include "brave/components/brave_ads/browser/ads_service.h"
#include "brave/components/brave_ads/browser/mock_ads_service.h"
#include "brave/components/brave_ads/common/features.h"
#include "brave/components/brave_ads/common/interfaces/ads.mojom.h"
#include "brave/components/constants/brave_paths.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
Expand Down
1 change: 0 additions & 1 deletion browser/brave_rewards/DEPS
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include_rules = [
"+bat/ledger",
"-bat/ledger/internal",
"+bat/ads/public",
]
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#include "base/types/expected.h"
#include "bat/ledger/mojom_structs.h"
#include "bat/ledger/public/interfaces/ledger_types.mojom.h"
#include "brave/components/brave_ads/common/interfaces/ads.mojom.h"
#include "brave/components/brave_rewards/browser/rewards_notification_service_observer.h"
#include "brave/components/brave_rewards/browser/rewards_service_observer.h"
#include "brave/vendor/bat-native-ads/include/bat/ads/public/interfaces/ads.mojom.h"
#include "brave/vendor/bat-native-ledger/include/bat/ledger/public/interfaces/ledger_types.mojom.h"

namespace brave_rewards {
Expand Down
2 changes: 1 addition & 1 deletion browser/extensions/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ source_set("extensions") {
"//brave/common/extensions/api",
"//brave/components/brave_adaptive_captcha",
"//brave/components/brave_ads/browser",
"//brave/components/brave_ads/core",
"//brave/components/brave_component_updater/browser",
"//brave/components/brave_rewards/browser",
"//brave/components/brave_rewards/common",
Expand All @@ -78,7 +79,6 @@ source_set("extensions") {
"//brave/components/ipfs/buildflags",
"//brave/components/ntp_widget_utils/browser",
"//brave/components/tor/buildflags",
"//brave/vendor/bat-native-ads:headers",
"//brave/vendor/bat-native-ledger:headers",
"//chrome/browser/extensions",
"//chrome/common",
Expand Down
3 changes: 0 additions & 3 deletions browser/extensions/DEPS

This file was deleted.

2 changes: 1 addition & 1 deletion browser/extensions/api/brave_rewards_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "base/functional/bind.h"
#include "base/strings/string_number_conversions.h"
#include "base/version.h"
#include "bat/ads/supported_subdivisions.h"
#include "brave/browser/brave_adaptive_captcha/brave_adaptive_captcha_service_factory.h"
#include "brave/browser/brave_ads/ads_service_factory.h"
#include "brave/browser/brave_rewards/rewards_panel/rewards_panel_coordinator.h"
Expand All @@ -26,6 +25,7 @@
#include "brave/common/extensions/api/brave_rewards.h"
#include "brave/components/brave_adaptive_captcha/brave_adaptive_captcha_service.h"
#include "brave/components/brave_ads/browser/ads_service.h"
#include "brave/components/brave_ads/core/supported_subdivisions.h"
#include "brave/components/brave_rewards/browser/rewards_service.h"
#include "brave/components/brave_rewards/common/pref_names.h"
#include "brave/components/brave_rewards/common/rewards_util.h"
Expand Down
2 changes: 1 addition & 1 deletion browser/extensions/api/brave_rewards_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <vector>

#include "base/types/expected.h"
#include "brave/vendor/bat-native-ads/include/bat/ads/public/interfaces/ads.mojom.h"
#include "brave/components/brave_ads/common/interfaces/ads.mojom.h"
#include "brave/vendor/bat-native-ledger/include/bat/ledger/mojom_structs.h"
#include "brave/vendor/bat-native-ledger/include/bat/ledger/public/interfaces/ledger_types.mojom.h"
#include "extensions/browser/extension_function.h"
Expand Down
1 change: 0 additions & 1 deletion browser/sources.gni
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ brave_chrome_browser_visibility = [
"//brave/test:*",

# these are layering violation and need to be fixed
"//brave/components/brave_ads/test:*",
"//brave/components/ipfs/test:*",

# Chrome does not yet define a visibility list by itself, meaning we can't
Expand Down
8 changes: 5 additions & 3 deletions browser/ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ source_set("favicon_source") {
source_set("ui") {
# Remove when https://github.com/brave/brave-browser/issues/10614 is resolved
check_includes = false
deps = []
public_deps = []
sources = [
"webui/brave_adblock_internals_ui.cc",
Expand Down Expand Up @@ -224,7 +225,9 @@ source_set("ui") {
]
}

public_deps += [ "//brave/vendor/bat-native-ads" ]
deps += [ "//brave/components/brave_ads/core" ]

public_deps += [ "//brave/components/brave_ads/common/interfaces" ]
}

if (toolkit_views) {
Expand Down Expand Up @@ -393,7 +396,7 @@ source_set("ui") {
]
}

deps = [
deps += [
"tabs",
"//base",
"//brave/app:command_ids",
Expand All @@ -414,7 +417,6 @@ source_set("ui") {
"//brave/components/brave_adblock_ui:generated_resources",
"//brave/components/brave_adblock_ui/adblock_internals:generated_resources",
"//brave/components/brave_ads/browser",
"//brave/components/brave_ads/browser",
"//brave/components/brave_federated",
"//brave/components/brave_federated/public/interfaces",
"//brave/components/brave_rewards/browser",
Expand Down
1 change: 0 additions & 1 deletion browser/ui/webui/DEPS
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
include_rules = [
"+chrome/services/qrcode_generator/public/mojom",
"+chrome/services/qrcode_generator/public/cpp",
"+bat/ads/supported_subdivisions.h",
"+bat/ledger/mojom_structs.h",
]
2 changes: 1 addition & 1 deletion browser/ui/webui/brave_rewards_page_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
#include "base/scoped_observation.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
#include "bat/ads/supported_subdivisions.h"
#include "bat/ledger/mojom_structs.h"
#include "brave/browser/brave_ads/ads_service_factory.h"
#include "brave/browser/brave_rewards/rewards_service_factory.h"
#include "brave/browser/ui/webui/brave_webui_source.h"
#include "brave/components/brave_ads/browser/ads_service.h"
#include "brave/components/brave_ads/common/pref_names.h"
#include "brave/components/brave_ads/core/supported_subdivisions.h"
#include "brave/components/brave_rewards/browser/rewards_notification_service.h"
#include "brave/components/brave_rewards/browser/rewards_notification_service_observer.h"
#include "brave/components/brave_rewards/browser/rewards_service.h"
Expand Down
6 changes: 5 additions & 1 deletion chromium_presubmit_config.json5
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"CheckForRelativeIncludes": ["chromium_src/"],
"CheckParseErrors": [
".*tsconfig\\.json",
"vendor/bat-native-ads/data/test/invalid\\.json",
"components/brave_ads/core/test/data/invalid\\.json",
],

// Checks to be fixed.
Expand Down Expand Up @@ -299,6 +299,10 @@
"components/cosmetic_filters/renderer/cosmetic_filters_js_handler\\.h",
"components/speedreader/renderer/speedreader_js_handler\\.h",
],
// A temporary fix to silence a crashing presubmit check on a deleted file.
"CheckStableMojomChanges": [
"components/services/bat_ads/public/interfaces/bat_ads\\.mojom",
],
"CheckWebDevStyle": [
"components/speedreader/resources/speedreader-desktop.css",
"components/speedreader/resources/third_party/",
Expand Down
7 changes: 6 additions & 1 deletion common/extensions/api/BUILD.gn
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) 2023 The Brave Authors. All rights reserved.
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/browser/ethereum_remote_client/buildflags/buildflags.gni")
import("//brave/components/ipfs/buildflags/buildflags.gni")
import("//brave/resources/brave_grit.gni")
Expand Down Expand Up @@ -97,7 +102,7 @@ function_registration("generated_api_registration") {
root_namespace = brave_extensions_api_root_namespace

deps = [
"//brave/vendor/bat-native-ads/include/bat/ads/public/interfaces",
"//brave/components/brave_ads/common/interfaces",
"//brave/vendor/bat-native-ledger/include/bat/ledger/public/interfaces",
"//extensions/common",
]
Expand Down
3 changes: 2 additions & 1 deletion components/brave_ads/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ source_set("browser") {
"//base",
"//brave/components/brave_adaptive_captcha",
"//brave/components/brave_ads/common",
"//brave/components/brave_ads/core",
"//brave/components/brave_ads/resources",
"//brave/components/brave_component_updater/browser",
"//brave/components/l10n/common",
Expand All @@ -45,7 +46,7 @@ source_set("browser") {
"//url",
]

public_deps = [ "//brave/vendor/bat-native-ads" ]
public_deps = [ "//brave/components/brave_ads/common/interfaces" ]

# TODO(https://github.com/brave/brave-browser/issues/24163)
check_includes = false
Expand Down
2 changes: 0 additions & 2 deletions components/brave_ads/browser/DEPS
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

include_rules = [
"+bat/ads",
"-bat/ads/internal",
"+bat/ledger/mojom_structs.h",
"+brave/components/constants",
"+content/public/browser",
Expand Down
4 changes: 2 additions & 2 deletions components/brave_ads/browser/ads_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include "base/values.h"
#include "brave/components/brave_ads/browser/ads_service_callback.h"
#include "brave/components/brave_ads/browser/ads_service_observer.h"
#include "brave/vendor/bat-native-ads/include/bat/ads/new_tab_page_ad_info.h"
#include "brave/vendor/bat-native-ads/include/bat/ads/public/interfaces/ads.mojom.h" // IWYU pragma: keep
#include "brave/components/brave_ads/common/interfaces/ads.mojom.h" // IWYU pragma: keep
#include "brave/components/brave_ads/core/new_tab_page_ad_info.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/sessions/core/session_id.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
Expand Down
2 changes: 1 addition & 1 deletion components/brave_ads/browser/ads_service_callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "base/functional/callback.h"
#include "base/values.h"
#include "brave/vendor/bat-native-ads/include/bat/ads/public/interfaces/ads.mojom-forward.h"
#include "brave/components/brave_ads/common/interfaces/ads.mojom-forward.h"
#include "third_party/abseil-cpp/absl/types/optional.h"

namespace brave_ads {
Expand Down
16 changes: 8 additions & 8 deletions components/brave_ads/browser/ads_service_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/timer/timer.h"
#include "bat/ads/ad_constants.h"
#include "bat/ads/ads.h"
#include "bat/ads/database.h"
#include "bat/ads/new_tab_page_ad_info.h"
#include "bat/ads/new_tab_page_ad_value_util.h"
#include "bat/ads/notification_ad_info.h"
#include "bat/ads/notification_ad_value_util.h"
#include "bat/ads/resources/grit/bat_ads_resources.h"
#include "brave/browser/brave_ads/notification_helper/notification_helper.h"
#include "brave/browser/brave_ads/notifications/notification_ad_platform_bridge.h"
#include "brave/browser/brave_browser_process.h"
Expand All @@ -50,6 +42,14 @@
#include "brave/components/brave_ads/common/constants.h"
#include "brave/components/brave_ads/common/features.h"
#include "brave/components/brave_ads/common/pref_names.h"
#include "brave/components/brave_ads/core/ad_constants.h"
#include "brave/components/brave_ads/core/ads.h"
#include "brave/components/brave_ads/core/database.h"
#include "brave/components/brave_ads/core/new_tab_page_ad_info.h"
#include "brave/components/brave_ads/core/new_tab_page_ad_value_util.h"
#include "brave/components/brave_ads/core/notification_ad_info.h"
#include "brave/components/brave_ads/core/notification_ad_value_util.h"
#include "brave/components/brave_ads/resources/grit/bat_ads_resources.h"
#include "brave/components/brave_federated/data_stores/async_data_store.h"
#include "brave/components/brave_news/common/features.h"
#include "brave/components/brave_news/common/pref_names.h"
Expand Down
2 changes: 1 addition & 1 deletion components/brave_ads/browser/ads_service_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
#include "base/task/cancelable_task_tracker.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "bat/ads/public/interfaces/ads.mojom.h"
#include "brave/browser/brave_ads/background_helper/background_helper.h"
#include "brave/components/brave_adaptive_captcha/brave_adaptive_captcha_service.h"
#include "brave/components/brave_ads/browser/ads_service.h"
#include "brave/components/brave_ads/browser/component_updater/resource_component_observer.h"
#include "brave/components/brave_ads/common/interfaces/ads.mojom.h"
#include "brave/components/services/bat_ads/public/interfaces/bat_ads.mojom.h"
#include "brave/vendor/bat-native-ledger/include/bat/ledger/public/interfaces/ledger.mojom-forward.h"
#include "components/history/core/browser/history_service.h"
Expand Down
2 changes: 1 addition & 1 deletion components/brave_ads/browser/frequency_capping_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <vector>

#include "base/memory/singleton.h"
#include "bat/ads/ad_event_history.h"
#include "brave/components/brave_ads/core/ad_event_history.h"

namespace base {
class Time;
Expand Down
2 changes: 1 addition & 1 deletion components/brave_ads/common/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <cstdint>

// TODO(https://github.com/brave/brave-browser/issues/13793): Rename ads
// namespace to brave_ads when bat-native-ads is moved to components/brave_ads
// namespace to brave_ads
namespace ads {

// Brave Ads current version number
Expand Down
3 changes: 1 addition & 2 deletions components/brave_ads/common/pref_names.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ const char kSupportedCountryCodesLastSchemaVersion[] =
} // namespace brave_ads::prefs

// TODO(https://github.com/brave/brave-browser/issues/13793): Rename ads::prefs
// namespace to brave_ads::prefs when bat-native-ads is moved to
// components/brave_ads
// namespace to brave_ads::prefs
namespace ads::prefs {

// Stores whether Brave ads is enabled or disabled
Expand Down
3 changes: 1 addition & 2 deletions components/brave_ads/common/pref_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ extern const char kSupportedCountryCodesLastSchemaVersion[];
} // namespace brave_ads::prefs

// TODO(https://github.com/brave/brave-browser/issues/13793): Rename ads::prefs
// namespace to brave_ads::prefs when bat-native-ads is moved to
// components/brave_ads
// namespace to brave_ads::prefs
namespace ads::prefs {

// Brave Ads enabled/disabled pref
Expand Down
4 changes: 2 additions & 2 deletions components/brave_ads/content/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static_library("browser") {
"//base",
"//brave/components/brave_ads/browser",
"//brave/components/brave_ads/common",
"//brave/components/brave_ads/core/browser",
"//brave/components/brave_ads/core",
"//brave/components/brave_search/common",
"//components/schema_org/common:mojom",
"//content/public/browser",
Expand All @@ -24,7 +24,7 @@ static_library("browser") {
]

public_deps = [
"//brave/vendor/bat-native-ads",
"//brave/components/brave_ads/common/interfaces",
"//third_party/blink/public/mojom:mojom_platform_headers",
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
#include "base/ranges/algorithm.h"
#include "brave/components/brave_ads/browser/ads_service.h"
#include "brave/components/brave_ads/common/features.h"
#include "brave/components/brave_ads/core/browser/search_result_ad/search_result_ad_converting_util.h"
#include "brave/components/brave_ads/core/browser/search_result_ad/search_result_ad_util.h"
#include "brave/components/brave_ads/common/interfaces/ads.mojom.h"
#include "brave/components/brave_ads/core/search_result_ad/search_result_ad_converting_util.h"
#include "brave/components/brave_ads/core/search_result_ad/search_result_ad_util.h"
#include "brave/components/brave_search/common/brave_search_utils.h"
#include "brave/vendor/bat-native-ads/include/bat/ads/public/interfaces/ads.mojom.h"
#include "content/public/browser/render_frame_host.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "base/containers/flat_map.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "brave/vendor/bat-native-ads/include/bat/ads/public/interfaces/ads.mojom-forward.h"
#include "brave/components/brave_ads/common/interfaces/ads.mojom-forward.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/document_metadata/document_metadata.mojom.h"
Expand Down
Loading

0 comments on commit 97e803b

Please sign in to comment.