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

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

Issue 243633003: use the right NativeTheme on bubbles + dialogs on Aura Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rejigger Created 6 years, 8 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/libgtk2ui/gtk2_ui.h » ('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 c04caff3cce768052aad98866030fda5068da08a..f22e58c5adaeec96b2d8528f90da2d952dd96617 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
@@ -19,9 +19,13 @@
#include "ui/views/widget/native_widget_aura.h"
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+#include "base/prefs/pref_service.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/libgtk2ui/gtk2_ui.h"
+#include "chrome/common/pref_names.h"
+#include "ui/aura/window.h"
+#include "ui/native_theme/native_theme_aura.h"
#include "ui/views/linux_ui/linux_ui.h"
-#else
#endif
#if defined(USE_ASH)
@@ -38,6 +42,22 @@
namespace {
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+ui::NativeTheme* GetNativeThemeForWindow(aura::Window* window) {
+ Profile* profile = NULL;
+ if (window->type() == ui::wm::WINDOW_TYPE_NORMAL ||
+ window->type() == ui::wm::WINDOW_TYPE_POPUP) {
+ profile = reinterpret_cast<Profile*>(
+ window->GetNativeWindowProperty(Profile::kProfileKey));
+ }
+
+ if (profile && !profile->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme))
+ return ui::NativeThemeAura::instance();
+
+ return NULL;
+}
+#endif
+
#if !defined(OS_CHROMEOS) && defined(USE_ASH)
// Returns the desktop this process was initially launched in.
chrome::HostDesktopType GetInitialDesktop() {
@@ -61,9 +81,11 @@ ChromeBrowserMainExtraPartsAura::~ChromeBrowserMainExtraPartsAura() {
}
void ChromeBrowserMainExtraPartsAura::PreEarlyInitialization() {
-#if !defined(USE_ASH) && defined(OS_LINUX) && defined(USE_X11)
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
// TODO(erg): Refactor this into a dlopen call when we add a GTK3 port.
- views::LinuxUI::SetInstance(BuildGtk2UI());
+ views::LinuxUI* gtk2_ui = BuildGtk2UI();
+ gtk2_ui->SetNativeThemeOverride(base::Bind(&GetNativeThemeForWindow));
+ views::LinuxUI::SetInstance(gtk2_ui);
#endif
}
« no previous file with comments | « no previous file | chrome/browser/ui/libgtk2ui/gtk2_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698