Skip to content

Commit

Permalink
Use separated theme service for tor profile
Browse files Browse the repository at this point in the history
As we use different theme colors for tor window(previously, same with private), we should
differentiate tor and private profile from ThemeHelper. However, upstream chromium uses
only two kinds of theme provider. One for orignal theme provider and the other is incognito
theme provider. If we want to add another theme provider for tor, it will add many patch files.
So, I think using different theme service for tor profile is simplest way to have tor specific
theme colors.
  • Loading branch information
simonhong committed Nov 25, 2020
1 parent 721c604 commit 77a0980
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions chromium_src/chrome/browser/themes/theme_service_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,9 @@
#define BRAVE_THEMESERVICEFACTORY_BUILDSERVICEINSTANCEFOR
#endif

#define BRAVE_THEMESERVICEFACTORY_GETBROWSERCONTEXTTOUSE \
if (context->IsTor()) return context;

#include "../../../../../chrome/browser/themes/theme_service_factory.cc"
#undef BRAVE_THEMESERVICEFACTORY_BUILDSERVICEINSTANCEFOR
#undef BRAVE_THEMESERVICEFACTORY_GETBROWSERCONTEXTTOUSE
10 changes: 9 additions & 1 deletion patches/chrome-browser-themes-theme_service_factory.cc.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/chrome/browser/themes/theme_service_factory.cc b/chrome/browser/themes/theme_service_factory.cc
index caec77bbe3ba59b030622d3a9ff4fb1edd0a476d..b1b48ed7fb8022d6377594754ce1f300b01a8fca 100644
index caec77bbe3ba59b030622d3a9ff4fb1edd0a476d..e6d475bc2908d5a30376535c8988d8a45db78b36 100644
--- a/chrome/browser/themes/theme_service_factory.cc
+++ b/chrome/browser/themes/theme_service_factory.cc
@@ -77,6 +77,7 @@ ThemeServiceFactory::~ThemeServiceFactory() {}
Expand All @@ -10,3 +10,11 @@ index caec77bbe3ba59b030622d3a9ff4fb1edd0a476d..b1b48ed7fb8022d6377594754ce1f300
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
using ThemeService = ThemeServiceAuraLinux;
#endif
@@ -108,6 +109,7 @@ void ThemeServiceFactory::RegisterProfilePrefs(

content::BrowserContext* ThemeServiceFactory::GetBrowserContextToUse(
content::BrowserContext* context) const {
+ BRAVE_THEMESERVICEFACTORY_GETBROWSERCONTEXTTOUSE
return chrome::GetBrowserContextRedirectedInIncognito(context);
}

0 comments on commit 77a0980

Please sign in to comment.