Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc

Issue 1637203002: [MD] Don't use new OTR native-theming when using a custom browser theme. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move lifetime comment Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/dropdown_bar_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc
diff --git a/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc b/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc
index b16e886b586338cb47c02b1c42c6519f45a9e688..9c3b040a1dd7cd9f7bee3cd4749b08bb402c21a3 100644
--- a/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc
+++ b/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc
@@ -23,6 +23,8 @@
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
#include "base/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/themes/theme_service.h"
+#include "chrome/browser/themes/theme_service_factory.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/common/pref_names.h"
#include "ui/aura/window.h"
@@ -55,25 +57,25 @@ ui::NativeTheme* GetNativeThemeForWindow(aura::Window* window) {
// Window types not listed here (such as tooltips) will never use Chrome
// theming.
if (window->type() == ui::wm::WINDOW_TYPE_NORMAL ||
- window->type() == ui::wm::WINDOW_TYPE_POPUP ||
- window->type() == ui::wm::WINDOW_TYPE_CONTROL) {
+ window->type() == ui::wm::WINDOW_TYPE_POPUP) {
profile = reinterpret_cast<Profile*>(
window->GetNativeWindowProperty(Profile::kProfileKey));
}
- if (profile && !profile->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme)) {
- // Only toplevel browser windows and CONTROL type windows (such as the find
- // in page bar) should use special theming for off the record mode.
- // WINDOW_TYPE_NORMAL is not enough to distinguish browser windows because
- // it also encompasses dialogs.
- bool eligible_for_otr = window->type() == ui::wm::WINDOW_TYPE_CONTROL ||
- BrowserView::GetBrowserViewForNativeWindow(window);
- if (eligible_for_otr &&
- profile->GetProfileType() == Profile::INCOGNITO_PROFILE) {
- return ui::NativeThemeDarkAura::instance();
+ if (profile) {
+ ThemeService* ts = ThemeServiceFactory::GetForProfile(profile);
+ // If using the system (GTK) theme, don't use an Aura NativeTheme at all.
+ if (!ts->UsingSystemTheme()) {
+ // Use a dark theme for incognito browser windows that aren't
+ // custom-themed. Otherwise, normal Aura theme.
+ if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE &&
+ ts->UsingDefaultTheme() &&
+ BrowserView::GetBrowserViewForNativeWindow(window)) {
+ return ui::NativeThemeDarkAura::instance();
+ }
+
+ return ui::NativeThemeAura::instance();
}
-
- return ui::NativeThemeAura::instance();
}
return nullptr;
« no previous file with comments | « no previous file | chrome/browser/ui/views/dropdown_bar_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698