diff --git a/chromium_src/chrome/browser/profiles/profile_keyed_service_factory.h b/chromium_src/chrome/browser/profiles/profile_keyed_service_factory.h deleted file mode 100644 index 1bafa6df9c0b..000000000000 --- a/chromium_src/chrome/browser/profiles/profile_keyed_service_factory.h +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright (c) 2020 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/. */ - -#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_PROFILE_KEYED_SERVICE_FACTORY_H_ -#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_PROFILE_KEYED_SERVICE_FACTORY_H_ - -#include "chrome/browser/profiles/profile_selections.h" -#include "components/keyed_service/content/browser_context_keyed_service_factory.h" - -#define final override -#include "src/chrome/browser/profiles/profile_keyed_service_factory.h" // IWYU pragma: export -#undef final - -#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_PROFILE_KEYED_SERVICE_FACTORY_H_ diff --git a/chromium_src/chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service_factory.cc b/chromium_src/chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service_factory.cc index 1dec21e75471..0c7887fe9363 100644 --- a/chromium_src/chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service_factory.cc +++ b/chromium_src/chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service_factory.cc @@ -31,15 +31,9 @@ ExtensionTelemetryServiceFactory::ExtensionTelemetryServiceFactory() ProfileSelections::BuildNoProfilesSelected()) { } -content::BrowserContext* -ExtensionTelemetryServiceFactory::GetBrowserContextToUse( - content::BrowserContext* context) const { - return nullptr; -} - bool ExtensionTelemetryServiceFactory::ServiceIsCreatedWithBrowserContext() const { - return true; + return false; } bool ExtensionTelemetryServiceFactory::ServiceIsNULLWhileTesting() const { diff --git a/chromium_src/chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service_factory.h b/chromium_src/chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service_factory.h index 83ce3cc924af..2487b8fbc973 100644 --- a/chromium_src/chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service_factory.h +++ b/chromium_src/chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service_factory.h @@ -9,13 +9,8 @@ #include "base/no_destructor.h" #include "chrome/browser/profiles/profile_keyed_service_factory.h" -class KeyedService; class Profile; -namespace content { -class BrowserContext; -} - namespace safe_browsing { class ExtensionTelemetryService; @@ -39,8 +34,6 @@ class ExtensionTelemetryServiceFactory : public ProfileKeyedServiceFactory { ~ExtensionTelemetryServiceFactory() override = default; // BrowserContextKeyedServiceFactory: - content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const override; bool ServiceIsCreatedWithBrowserContext() const override; bool ServiceIsNULLWhileTesting() const override; }; diff --git a/chromium_src/chrome/browser/search_engine_choice/search_engine_choice_service_factory.cc b/chromium_src/chrome/browser/search_engine_choice/search_engine_choice_service_factory.cc index dd984b0c5688..acf43a87d2dc 100644 --- a/chromium_src/chrome/browser/search_engine_choice/search_engine_choice_service_factory.cc +++ b/chromium_src/chrome/browser/search_engine_choice/search_engine_choice_service_factory.cc @@ -5,17 +5,11 @@ #include "chrome/browser/search_engine_choice/search_engine_choice_service_factory.h" -#include "chrome/browser/profiles/incognito_helpers.h" +#define WithAshInternals(...) \ + WithAshInternals(__VA_ARGS__) \ + .WithRegular(ProfileSelection::kOwnInstance) \ + .WithGuest(ProfileSelection::kOwnInstance) #include "src/chrome/browser/search_engine_choice/search_engine_choice_service_factory.cc" -namespace search_engines { - -content::BrowserContext* -SearchEngineChoiceServiceFactory::GetBrowserContextToUse( - content::BrowserContext* context) const { - // To make different service for normal and incognito profile. - return chrome::GetBrowserContextOwnInstanceInIncognito(context); -} - -} // namespace search_engines +#undef WithAshInternals diff --git a/chromium_src/chrome/browser/search_engine_choice/search_engine_choice_service_factory.h b/chromium_src/chrome/browser/search_engine_choice/search_engine_choice_service_factory.h deleted file mode 100644 index 1da0320eb316..000000000000 --- a/chromium_src/chrome/browser/search_engine_choice/search_engine_choice_service_factory.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright (c) 2024 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/. */ - -#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_SEARCH_ENGINE_CHOICE_SEARCH_ENGINE_CHOICE_SERVICE_FACTORY_H_ -#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_SEARCH_ENGINE_CHOICE_SEARCH_ENGINE_CHOICE_SERVICE_FACTORY_H_ - -#include "chrome/browser/profiles/profile_keyed_service_factory.h" -#include "content/public/browser/browser_context.h" - -#define BuildServiceInstanceForBrowserContext \ - BuildServiceInstanceForBrowserContext_unused(); \ - content::BrowserContext* GetBrowserContextToUse( \ - content::BrowserContext* context) const override; \ - std::unique_ptr BuildServiceInstanceForBrowserContext - -#include "src/chrome/browser/search_engine_choice/search_engine_choice_service_factory.h" // IWYU pragma: export - -#undef BuildServiceInstanceForBrowserContext - -#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_SEARCH_ENGINE_CHOICE_SEARCH_ENGINE_CHOICE_SERVICE_FACTORY_H_ diff --git a/chromium_src/chrome/browser/search_engines/template_url_service_factory.cc b/chromium_src/chrome/browser/search_engines/template_url_service_factory.cc index d7a7c79dfd53..25759f54e6ef 100644 --- a/chromium_src/chrome/browser/search_engines/template_url_service_factory.cc +++ b/chromium_src/chrome/browser/search_engines/template_url_service_factory.cc @@ -5,13 +5,11 @@ #include "chrome/browser/search_engines/template_url_service_factory.h" -#include "chrome/browser/history/history_service_factory.h" -#include "chrome/browser/profiles/incognito_helpers.h" -#include "chrome/browser/webdata_services/web_data_service_factory.h" +#define WithAshInternals(...) \ + WithAshInternals(__VA_ARGS__) \ + .WithRegular(ProfileSelection::kOwnInstance) \ + .WithGuest(ProfileSelection::kOwnInstance) + #include "src/chrome/browser/search_engines/template_url_service_factory.cc" -content::BrowserContext* TemplateURLServiceFactory::GetBrowserContextToUse( - content::BrowserContext* context) const { - // To make different service for normal and incognito profile. - return chrome::GetBrowserContextOwnInstanceInIncognito(context); -} +#undef WithAshInternals diff --git a/chromium_src/chrome/browser/search_engines/template_url_service_factory.h b/chromium_src/chrome/browser/search_engines/template_url_service_factory.h deleted file mode 100644 index 9aece6ada19d..000000000000 --- a/chromium_src/chrome/browser/search_engines/template_url_service_factory.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (c) 2021 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/. */ - -#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_FACTORY_H_ -#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_FACTORY_H_ - -#include "chrome/browser/profiles/profile_keyed_service_factory.h" -#include "components/keyed_service/content/browser_context_keyed_service_factory.h" -#include "content/public/browser/browser_context.h" - -#define ServiceIsNULLWhileTesting \ - ServiceIsNULLWhileTesting_unused() { \ - return false; \ - } \ - content::BrowserContext* GetBrowserContextToUse( \ - content::BrowserContext* context) const override; \ - bool ServiceIsNULLWhileTesting - -#include "src/chrome/browser/search_engines/template_url_service_factory.h" // IWYU pragma: export - -#undef ServiceIsNULLWhileTesting - -#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_FACTORY_H_ diff --git a/chromium_src/chrome/browser/themes/theme_service_factory.cc b/chromium_src/chrome/browser/themes/theme_service_factory.cc index bb8b7f71bb48..0cdec3c48aa9 100644 --- a/chromium_src/chrome/browser/themes/theme_service_factory.cc +++ b/chromium_src/chrome/browser/themes/theme_service_factory.cc @@ -3,13 +3,9 @@ * 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/. */ -#include "brave/browser/themes/brave_theme_service.h" -// Below files are included in advance to prevent overriding -// GetBrowserContextToUse. -#include "chrome/browser/extensions/extension_system_factory.h" #include "chrome/browser/themes/theme_service_factory.h" -#include "extensions/browser/extension_prefs_factory.h" -#include "extensions/browser/extension_registry_factory.h" + +#include "brave/browser/themes/brave_theme_service.h" #if !BUILDFLAG(IS_LINUX) #define BRAVE_THEMESERVICEFACTORY_BUILDSERVICEINSTANCEFOR \ @@ -20,11 +16,5 @@ #endif #include "src/chrome/browser/themes/theme_service_factory.cc" -#undef BRAVE_THEMESERVICEFACTORY_BUILDSERVICEINSTANCEFOR -content::BrowserContext* ThemeServiceFactory::GetBrowserContextToUse( - content::BrowserContext* context) const { - if (context->IsTor()) - return context; - return ProfileKeyedServiceFactory::GetBrowserContextToUse(context); -} +#undef BRAVE_THEMESERVICEFACTORY_BUILDSERVICEINSTANCEFOR diff --git a/chromium_src/chrome/browser/themes/theme_service_factory.h b/chromium_src/chrome/browser/themes/theme_service_factory.h deleted file mode 100644 index ae929358cb0c..000000000000 --- a/chromium_src/chrome/browser/themes/theme_service_factory.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright (c) 2020 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/. */ - -#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_THEMES_THEME_SERVICE_FACTORY_H_ -#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_THEMES_THEME_SERVICE_FACTORY_H_ - -#include "chrome/browser/profiles/profile_keyed_service_factory.h" - -#define ServiceIsCreatedWithBrowserContext \ - ServiceIsCreatedWithBrowserContext_unused(); \ - content::BrowserContext* GetBrowserContextToUse( \ - content::BrowserContext* context) const override; \ - bool ServiceIsCreatedWithBrowserContext - -#include "src/chrome/browser/themes/theme_service_factory.h" // IWYU pragma: export - -#undef ServiceIsCreatedWithBrowserContext - -#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_THEMES_THEME_SERVICE_FACTORY_H_