Skip to content

Commit

Permalink
Remove override to not misuse ProfileKeyedServiceFactory. (#26089)
Browse files Browse the repository at this point in the history
Remove src override to not misuse ProfileKeyedServiceFactory.
  • Loading branch information
goodov authored Oct 22, 2024
1 parent a9151b2 commit dc8a84d
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 130 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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

This file was deleted.

16 changes: 3 additions & 13 deletions chromium_src/chrome/browser/themes/theme_service_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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
21 changes: 0 additions & 21 deletions chromium_src/chrome/browser/themes/theme_service_factory.h

This file was deleted.

0 comments on commit dc8a84d

Please sign in to comment.