Skip to content

Commit 05703bc

Browse files
committed
Use incognito theme for Tor profile windows
Forces tor profiles to be recognised as 'incognito' for theme. Also ensures that complementing omnibox theme is used. Also ensures that complementing dark 'native' theme is used. Fix brave/brave-browser#1383
1 parent 19ab2a9 commit 05703bc

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

browser/themes/brave_theme_service.cc

+3
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ void BraveThemeService::Init(Profile* profile) {
8484

8585

8686
SkColor BraveThemeService::GetDefaultColor(int id, bool incognito) const {
87+
// Brave Tor profiles are always 'incognito' (for now)
88+
if (!incognito && profile()->IsTorProfile())
89+
incognito = true;
8790
const BraveThemeType theme = GetActiveBraveThemeType(profile());
8891
const base::Optional<SkColor> braveColor = MaybeGetDefaultColorForBraveUi(id, incognito, theme);
8992
if (braveColor)

browser/ui/views/brave_browser_main_extra_parts_views_linux.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ ui::NativeTheme* GetNativeThemeForWindow(aura::Window* window) {
3333
BraveThemeService::GetActiveBraveThemeType(profile);
3434
const bool dark_mode = (
3535
active_builtin_theme == BraveThemeType::BRAVE_THEME_TYPE_DARK ||
36-
profile->GetProfileType() == Profile::INCOGNITO_PROFILE);
36+
profile->GetProfileType() == Profile::INCOGNITO_PROFILE ||
37+
profile->IsTorProfile());
3738
if (dark_mode &&
3839
BrowserView::GetBrowserViewForNativeWindow(window)) {
3940
return ui::NativeThemeDarkAura::instance();

browser/ui/views/frame/brave_browser_frame.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ const ui::NativeTheme* BraveBrowserFrame::GetNativeTheme() const {
2828
browser_view_->browser()->profile());
2929
if (active_builtin_theme == BraveThemeType::BRAVE_THEME_TYPE_DARK ||
3030
browser_view_->browser()->profile()->GetProfileType() ==
31-
Profile::INCOGNITO_PROFILE) {
31+
Profile::INCOGNITO_PROFILE ||
32+
browser_view_->browser()->profile()->IsTorProfile()) {
3233
return ui::NativeThemeDarkAura::instance();
3334
}
3435
#endif

browser/ui/views/location_bar/brave_location_bar_view.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ OmniboxTint BraveLocationBarView::GetTint() {
7373
// Match the user-selectable brave theme, even if there is a theme extension
7474
// installed, allowing non-extension-themeable elements to fit in better with
7575
// a theme extension.
76-
if (profile()->GetProfileType() == Profile::INCOGNITO_PROFILE) {
76+
if (profile()->GetProfileType() == Profile::INCOGNITO_PROFILE ||
77+
profile()->IsTorProfile()) {
7778
return OmniboxTint::PRIVATE; // special extra enum value
7879
}
7980
// TODO: BraveThemeService can have a simpler get dark / light function

0 commit comments

Comments
 (0)