[CodeHealth] Convert url sanitizer into a layered component (#31706)
- Everything in `browser` → `core/browser` - Everything in `common` → `core/common` - Moved unit test target to `brave_components_unittests` This will enable moving iOS bridges into the component in the future
This commit is contained in:
+1
-1
@@ -86,7 +86,7 @@ include_rules += [
|
||||
"+brave/components/https_upgrade_exceptions/browser",
|
||||
"+brave/components/brave_user_agent/browser",
|
||||
"+brave/components/localhost_permission",
|
||||
"+brave/components/url_sanitizer/browser",
|
||||
"+brave/components/url_sanitizer/core/browser",
|
||||
"+brave/components/body_sniffer",
|
||||
"+brave/components/brave_search/browser",
|
||||
"+brave/components/brave_search/common",
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "brave/components/speedreader/common/buildflags/buildflags.h"
|
||||
#include "brave/components/tor/brave_tor_pluggable_transport_updater.h"
|
||||
#include "brave/components/tor/buildflags/buildflags.h"
|
||||
#include "brave/components/url_sanitizer/browser/url_sanitizer_component_installer.h"
|
||||
#include "brave/components/url_sanitizer/core/browser/url_sanitizer_component_installer.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/browser/browser_process_impl.h"
|
||||
#include "extensions/buildflags/buildflags.h"
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
#include "brave/components/speedreader/common/buildflags/buildflags.h"
|
||||
#include "brave/components/tor/buildflags/buildflags.h"
|
||||
#include "brave/components/translate/core/common/brave_translate_switches.h"
|
||||
#include "brave/components/url_sanitizer/browser/url_sanitizer_service.h"
|
||||
#include "brave/components/url_sanitizer/core/browser/url_sanitizer_service.h"
|
||||
#include "brave/grit/brave_generated_resources.h"
|
||||
#include "brave/third_party/blink/renderer/brave_farbling_constants.h"
|
||||
#include "build/build_config.h"
|
||||
|
||||
+1
-1
@@ -848,7 +848,7 @@ source_set("ui") {
|
||||
"//brave/components/text_recognition/common/buildflags",
|
||||
"//brave/components/time_period_storage",
|
||||
"//brave/components/tor/buildflags",
|
||||
"//brave/components/url_sanitizer/browser",
|
||||
"//brave/components/url_sanitizer/core/browser",
|
||||
"//brave/components/vector_icons",
|
||||
"//brave/components/web_discovery/buildflags",
|
||||
"//brave/components/webui",
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "brave/components/sidebar/browser/sidebar_service.h"
|
||||
#include "brave/components/speedreader/common/buildflags/buildflags.h"
|
||||
#include "brave/components/tor/buildflags/buildflags.h"
|
||||
#include "brave/components/url_sanitizer/browser/url_sanitizer_service.h"
|
||||
#include "brave/components/url_sanitizer/core/browser/url_sanitizer_service.h"
|
||||
#include "chrome/browser/bookmarks/bookmark_html_writer.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "brave/browser/brave_browser_features.h"
|
||||
#include "brave/browser/url_sanitizer/url_sanitizer_service_factory.h"
|
||||
#include "brave/components/url_sanitizer/browser/url_sanitizer_service.h"
|
||||
#include "brave/components/url_sanitizer/core/browser/url_sanitizer_service.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/app/chrome_command_ids.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
|
||||
@@ -9,7 +9,7 @@ source_set("browser_tests") {
|
||||
|
||||
sources = [ "url_sanitizer_browsertest.cc" ]
|
||||
deps = [
|
||||
"//brave/components/url_sanitizer/browser",
|
||||
"//brave/components/url_sanitizer/core/browser",
|
||||
"//chrome/browser",
|
||||
"//chrome/browser/profiles:profile",
|
||||
"//chrome/browser/ui",
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
include_rules = [
|
||||
"+brave/components/url_sanitizer/common",
|
||||
"+brave/components/url_sanitizer/core/common",
|
||||
]
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
# Copyright (c) 2022 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/.
|
||||
|
||||
brave_browser_url_sanitizer_sources = [
|
||||
"//brave/browser/url_sanitizer/url_sanitizer_service_factory.cc",
|
||||
"//brave/browser/url_sanitizer/url_sanitizer_service_factory.h",
|
||||
@@ -5,7 +10,7 @@ brave_browser_url_sanitizer_sources = [
|
||||
|
||||
brave_browser_url_sanitizer_deps = [
|
||||
"//base",
|
||||
"//brave/components/url_sanitizer/browser",
|
||||
"//brave/components/url_sanitizer/core/browser",
|
||||
"//components/keyed_service/content",
|
||||
]
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "brave/browser/brave_browser_features.h"
|
||||
#include "brave/browser/url_sanitizer/url_sanitizer_service_factory.h"
|
||||
#include "brave/components/constants/brave_paths.h"
|
||||
#include "brave/components/url_sanitizer/browser/url_sanitizer_service.h"
|
||||
#include "brave/components/url_sanitizer/core/browser/url_sanitizer_service.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
#include "chrome/test/base/in_process_browser_test.h"
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
#include "base/feature_list.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "brave/browser/brave_browser_process.h"
|
||||
#include "brave/components/url_sanitizer/browser/url_sanitizer_component_installer.h"
|
||||
#include "brave/components/url_sanitizer/browser/url_sanitizer_service.h"
|
||||
#include "brave/components/url_sanitizer/core/browser/url_sanitizer_component_installer.h"
|
||||
#include "brave/components/url_sanitizer/core/browser/url_sanitizer_service.h"
|
||||
#include "chrome/browser/profiles/incognito_helpers.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "components/keyed_service/content/browser_context_dependency_manager.h"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
#include "brave/components/url_sanitizer/common/mojom/url_sanitizer.mojom.h"
|
||||
#include "brave/components/url_sanitizer/core/common/mojom/url_sanitizer.mojom.h"
|
||||
#include "mojo/public/cpp/bindings/pending_remote.h"
|
||||
#endif // # BUILDFLAG(IS_ANDROID)
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ brave_chrome_java_deps = [
|
||||
"//brave/components/playlist/core/common/mojom:mojom_java",
|
||||
"//brave/components/safe_browsing/android:brave_safe_browsing_java",
|
||||
"//brave/components/skus/common:mojom_java",
|
||||
"//brave/components/url_sanitizer/common/mojom:mojom_java",
|
||||
"//brave/components/url_sanitizer/core/common/mojom:mojom_java",
|
||||
"//brave/components/variations/android:java",
|
||||
"//brave/components/version_info/android:java",
|
||||
"//brave/components/webcompat_reporter/common:mojom_java",
|
||||
|
||||
@@ -36,6 +36,7 @@ test("brave_components_unittests") {
|
||||
"//brave/components/json:unit_tests",
|
||||
"//brave/components/static_redirect_helper:unit_tests",
|
||||
"//brave/components/update_client:unit_tests",
|
||||
"//brave/components/url_sanitizer/core/browser:unit_tests",
|
||||
"//components/test:run_all_unittests",
|
||||
]
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ component("browser") {
|
||||
"//brave/components/https_upgrade_exceptions/browser",
|
||||
"//brave/components/request_otr/browser",
|
||||
"//brave/components/tor",
|
||||
"//brave/components/url_sanitizer/browser",
|
||||
"//brave/components/url_sanitizer/core/browser",
|
||||
"//brave/components/webcompat/content/browser",
|
||||
"//brave/ios/app",
|
||||
"//brave/ios/browser/application_context",
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
# Copyright (c) 2022 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 http://mozilla.org/MPL/2.0/.
|
||||
# You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
source_set("browser") {
|
||||
sources = [
|
||||
@@ -10,7 +10,7 @@ source_set("browser") {
|
||||
"url_sanitizer_service.cc",
|
||||
"url_sanitizer_service.h",
|
||||
]
|
||||
public_deps = [ "//brave/components/url_sanitizer/common/mojom" ]
|
||||
public_deps = [ "//brave/components/url_sanitizer/core/common/mojom" ]
|
||||
deps = [
|
||||
"//base",
|
||||
"//brave/components/brave_component_updater/browser",
|
||||
@@ -21,7 +21,7 @@ source_set("browser") {
|
||||
]
|
||||
}
|
||||
|
||||
source_set("unittests") {
|
||||
source_set("unit_tests") {
|
||||
testonly = true
|
||||
|
||||
sources = [ "url_sanitizer_service_unittest.cc" ]
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
/* Copyright (c) 2022 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 http://mozilla.org/MPL/2.0/. */
|
||||
* You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "brave/components/url_sanitizer/browser/url_sanitizer_component_installer.h"
|
||||
#include "brave/components/url_sanitizer/core/browser/url_sanitizer_component_installer.h"
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
/* Copyright (c) 2022 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 http://mozilla.org/MPL/2.0/. */
|
||||
* You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef BRAVE_COMPONENTS_URL_SANITIZER_BROWSER_URL_SANITIZER_COMPONENT_INSTALLER_H_
|
||||
#define BRAVE_COMPONENTS_URL_SANITIZER_BROWSER_URL_SANITIZER_COMPONENT_INSTALLER_H_
|
||||
#ifndef BRAVE_COMPONENTS_URL_SANITIZER_CORE_BROWSER_URL_SANITIZER_COMPONENT_INSTALLER_H_
|
||||
#define BRAVE_COMPONENTS_URL_SANITIZER_CORE_BROWSER_URL_SANITIZER_COMPONENT_INSTALLER_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
@@ -68,4 +68,4 @@ class URLSanitizerComponentInstaller
|
||||
|
||||
} // namespace brave
|
||||
|
||||
#endif // BRAVE_COMPONENTS_URL_SANITIZER_BROWSER_URL_SANITIZER_COMPONENT_INSTALLER_H_
|
||||
#endif // BRAVE_COMPONENTS_URL_SANITIZER_CORE_BROWSER_URL_SANITIZER_COMPONENT_INSTALLER_H_
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
/* Copyright (c) 2022 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 http://mozilla.org/MPL/2.0/. */
|
||||
* You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "brave/components/url_sanitizer/browser/url_sanitizer_service.h"
|
||||
#include "brave/components/url_sanitizer/core/browser/url_sanitizer_service.h"
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
/* Copyright (c) 2022 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 http://mozilla.org/MPL/2.0/. */
|
||||
* You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef BRAVE_COMPONENTS_URL_SANITIZER_BROWSER_URL_SANITIZER_SERVICE_H_
|
||||
#define BRAVE_COMPONENTS_URL_SANITIZER_BROWSER_URL_SANITIZER_SERVICE_H_
|
||||
#ifndef BRAVE_COMPONENTS_URL_SANITIZER_CORE_BROWSER_URL_SANITIZER_SERVICE_H_
|
||||
#define BRAVE_COMPONENTS_URL_SANITIZER_CORE_BROWSER_URL_SANITIZER_SERVICE_H_
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@@ -13,8 +13,8 @@
|
||||
#include "base/containers/flat_set.h"
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "brave/components/url_sanitizer/browser/url_sanitizer_component_installer.h"
|
||||
#include "brave/components/url_sanitizer/common/mojom/url_sanitizer.mojom.h"
|
||||
#include "brave/components/url_sanitizer/core/browser/url_sanitizer_component_installer.h"
|
||||
#include "brave/components/url_sanitizer/core/common/mojom/url_sanitizer.mojom.h"
|
||||
#include "components/keyed_service/core/keyed_service.h"
|
||||
#include "extensions/common/url_pattern_set.h"
|
||||
#include "url/gurl.h"
|
||||
@@ -102,4 +102,4 @@ class URLSanitizerService : public KeyedService,
|
||||
|
||||
} // namespace brave
|
||||
|
||||
#endif // BRAVE_COMPONENTS_URL_SANITIZER_BROWSER_URL_SANITIZER_SERVICE_H_
|
||||
#endif // BRAVE_COMPONENTS_URL_SANITIZER_CORE_BROWSER_URL_SANITIZER_SERVICE_H_
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
/* Copyright (c) 2022 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 http://mozilla.org/MPL/2.0/. */
|
||||
* You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "brave/components/url_sanitizer/browser/url_sanitizer_service.h"
|
||||
#include "brave/components/url_sanitizer/core/browser/url_sanitizer_service.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import("//extensions/buildflags/buildflags.gni")
|
||||
# content_settings::ContentSettingsPattern, etc..
|
||||
deprecated_visibility_allowed = [
|
||||
"//brave/components/static_redirect_helper",
|
||||
"//brave/components/url_sanitizer/browser",
|
||||
"//brave/components/url_sanitizer/core/browser",
|
||||
"//brave/components/debounce/core/browser",
|
||||
"//brave/components/ntp_background_images/browser",
|
||||
"//brave/components/psst/browser/core",
|
||||
|
||||
@@ -11,7 +11,7 @@ source_set("url_sanitizer") {
|
||||
]
|
||||
deps = [
|
||||
"//base",
|
||||
"//brave/components/url_sanitizer/browser",
|
||||
"//brave/components/url_sanitizer/core/browser",
|
||||
"//net",
|
||||
"//url",
|
||||
]
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
include_rules = [
|
||||
"+brave/components/url_sanitizer/browser",
|
||||
"+brave/components/url_sanitizer/core/browser",
|
||||
]
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "brave/components/url_sanitizer/browser/url_sanitizer_service.h"
|
||||
#include "brave/components/url_sanitizer/core/browser/url_sanitizer_service.h"
|
||||
#include "brave/ios/browser/api/url_sanitizer/url_sanitizer_service.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -3,7 +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/.
|
||||
|
||||
#include "brave/components/url_sanitizer/browser/url_sanitizer_service.h"
|
||||
#include "brave/components/url_sanitizer/core/browser/url_sanitizer_service.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ source_set("application_context") {
|
||||
"//brave/components/brave_wallet/browser",
|
||||
"//brave/components/debounce/core/browser",
|
||||
"//brave/components/https_upgrade_exceptions/browser",
|
||||
"//brave/components/url_sanitizer/browser",
|
||||
"//brave/components/url_sanitizer/core/browser",
|
||||
"//brave/ios/browser/brave_wallet",
|
||||
"//components/application_locale_storage",
|
||||
"//ios/chrome/browser/application_context/model",
|
||||
|
||||
@@ -4,5 +4,5 @@ include_rules = [
|
||||
"+brave/components/debounce/core/browser",
|
||||
"+brave/components/brave_wallet/browser",
|
||||
"+brave/components/https_upgrade_exceptions/browser",
|
||||
"+brave/components/url_sanitizer/browser",
|
||||
"+brave/components/url_sanitizer/core/browser",
|
||||
]
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "brave/components/brave_component_updater/browser/brave_component.h"
|
||||
#include "brave/components/debounce/core/browser/debounce_component_installer.h"
|
||||
#include "brave/components/https_upgrade_exceptions/browser/https_upgrade_exceptions_service.h"
|
||||
#include "brave/components/url_sanitizer/browser/url_sanitizer_component_installer.h"
|
||||
#include "brave/components/url_sanitizer/core/browser/url_sanitizer_component_installer.h"
|
||||
#include "ios/chrome/browser/application_context/model/application_context_impl.h"
|
||||
|
||||
namespace base {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "brave/components/brave_wallet/browser/wallet_data_files_installer.h"
|
||||
#include "brave/components/debounce/core/browser/debounce_component_installer.h"
|
||||
#include "brave/components/https_upgrade_exceptions/browser/https_upgrade_exceptions_service.h"
|
||||
#include "brave/components/url_sanitizer/browser/url_sanitizer_component_installer.h"
|
||||
#include "brave/components/url_sanitizer/core/browser/url_sanitizer_component_installer.h"
|
||||
#include "brave/ios/browser/brave_wallet/wallet_data_files_installer_delegate_impl.h"
|
||||
#include "components/application_locale_storage/application_locale_storage.h"
|
||||
#include "ios/chrome/browser/shared/model/application_context/application_context.h"
|
||||
|
||||
@@ -11,7 +11,7 @@ source_set("url_sanitizer") {
|
||||
]
|
||||
deps = [
|
||||
"//base",
|
||||
"//brave/components/url_sanitizer/browser",
|
||||
"//brave/components/url_sanitizer/core/browser",
|
||||
"//brave/ios/browser/api/url_sanitizer",
|
||||
"//brave/ios/browser/application_context",
|
||||
"//brave/ios/browser/keyed_service",
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
include_rules = [
|
||||
"+brave/components/url_sanitizer/browser",
|
||||
"+brave/components/url_sanitizer/core/browser",
|
||||
]
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#include "brave/ios/browser/url_sanitizer/url_sanitizer_service_factory.h"
|
||||
|
||||
#include "base/no_destructor.h"
|
||||
#include "brave/components/url_sanitizer/browser/url_sanitizer_component_installer.h"
|
||||
#include "brave/components/url_sanitizer/browser/url_sanitizer_service.h"
|
||||
#include "brave/components/url_sanitizer/core/browser/url_sanitizer_component_installer.h"
|
||||
#include "brave/components/url_sanitizer/core/browser/url_sanitizer_service.h"
|
||||
#include "brave/ios/browser/api/url_sanitizer/url_sanitizer_service+private.h"
|
||||
#include "brave/ios/browser/application_context/brave_application_context_impl.h"
|
||||
#include "brave/ios/browser/keyed_service/keyed_service_factory_wrapper+private.h"
|
||||
|
||||
+1
-2
@@ -271,7 +271,6 @@ test("brave_unit_tests") {
|
||||
"//brave/components/sync/service:unit_tests",
|
||||
"//brave/components/time_period_storage",
|
||||
"//brave/components/tor/buildflags",
|
||||
"//brave/components/url_sanitizer/browser:unittests",
|
||||
"//brave/components/variations:unit_tests",
|
||||
"//brave/components/version_info:unit_tests",
|
||||
"//brave/components/webcompat/content/browser",
|
||||
@@ -929,7 +928,7 @@ test("brave_browser_tests") {
|
||||
"//brave/components/skus/common",
|
||||
"//brave/components/speedreader/common/buildflags",
|
||||
"//brave/components/tor/buildflags",
|
||||
"//brave/components/url_sanitizer/browser",
|
||||
"//brave/components/url_sanitizer/core/browser",
|
||||
"//brave/components/web_discovery/buildflags",
|
||||
"//brave/components/webcompat/core/common",
|
||||
"//brave/renderer/skus:browser_tests",
|
||||
|
||||
Reference in New Issue
Block a user