diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-22 15:39:17 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-22 15:39:17 +0000 |
commit | 9c0c5d1ddcc14119336ce61f7b22fec4ce3ee694 (patch) | |
tree | f608150471f9c99f7b895efeefc4a29cb7494789 | |
parent | 2200e6d498a82fad8af88b4d9a7235010473d14a (diff) | |
download | chromium_src-9c0c5d1ddcc14119336ce61f7b22fec4ce3ee694.zip chromium_src-9c0c5d1ddcc14119336ce61f7b22fec4ce3ee694.tar.gz chromium_src-9c0c5d1ddcc14119336ce61f7b22fec4ce3ee694.tar.bz2 |
linux_aura: Three fixes for switching themes.
Native system theming was badly hacked into ThemeService with ifdefs. This
correlates the code into its own file, which should be conditionally compiled
out.
When doing any switching of themes, we weren't notifying the non client view of
the change.
Make the options page in the linux_aura port behave the same way as in the GTK+
port.
BUG=130810
Review URL: https://chromiumcodereview.appspot.com/17494005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208060 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/resources/options/browser_options.html | 8 | ||||
-rw-r--r-- | chrome/browser/resources/options/browser_options.js | 15 | ||||
-rw-r--r-- | chrome/browser/themes/theme_service.cc | 16 | ||||
-rw-r--r-- | chrome/browser/themes/theme_service_aurax11.cc | 85 | ||||
-rw-r--r-- | chrome/browser/themes/theme_service_aurax11.h | 43 | ||||
-rw-r--r-- | chrome/browser/themes/theme_service_factory.cc | 19 | ||||
-rw-r--r-- | chrome/browser/ui/libgtk2ui/gtk2_ui.cc | 23 | ||||
-rw-r--r-- | chrome/browser/ui/libgtk2ui/gtk2_ui.h | 2 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options/browser_options_handler.cc | 37 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options/browser_options_handler.h | 4 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 4 | ||||
-rw-r--r-- | chrome/common/pref_names.cc | 4 | ||||
-rw-r--r-- | chrome/common/pref_names.h | 2 | ||||
-rw-r--r-- | ui/linux_ui/linux_ui.h | 5 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc | 4 |
15 files changed, 218 insertions, 53 deletions
diff --git a/chrome/browser/resources/options/browser_options.html b/chrome/browser/resources/options/browser_options.html index 6163060..1125ee7 100644 --- a/chrome/browser/resources/options/browser_options.html +++ b/chrome/browser/resources/options/browser_options.html @@ -31,14 +31,14 @@ <button id="set-wallpaper" i18n-content="setWallpaper" guest-visibility="disabled"></button> </if> -<if expr="not pp_ifdef('toolkit_views') and is_posix and not is_macosx"> +<if expr="not pp_ifdef('chromeos') and is_posix and not is_macosx"> <button id="themes-gallery" i18n-content="themesGallery"></button> - <button id="themes-GTK-button" - i18n-content="themesGTKButton"></button> + <button id="themes-native-button" + i18n-content="themesNativeButton"></button> <button id="themes-reset" i18n-content="themesSetClassic"></button> </if> -<if expr="pp_ifdef('toolkit_views') or is_win or is_macosx"> +<if expr="pp_ifdef('chromeos') or is_win or is_macosx"> <button id="themes-gallery" i18n-content="themesGallery"></button> <button id="themes-reset" i18n-content="themesReset"></button> </if> diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js index 5ce9416..f437748 100644 --- a/chrome/browser/resources/options/browser_options.js +++ b/chrome/browser/resources/options/browser_options.js @@ -235,9 +235,9 @@ cr.define('options', function() { chrome.send('coreOptionsUserMetricsAction', ['Import_ShowDlg']); }; - if ($('themes-GTK-button')) { - $('themes-GTK-button').onclick = function(event) { - chrome.send('themesSetGTK'); + if ($('themes-native-button')) { + $('themes-native-button').onclick = function(event) { + chrome.send('themesSetNative'); }; } } @@ -1114,9 +1114,10 @@ cr.define('options', function() { 'There should always be a current profile, but none found.'); }, - setGtkThemeButtonEnabled_: function(enabled) { - if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) - $('themes-GTK-button').disabled = !enabled; + setNativeThemeButtonEnabled_: function(enabled) { + var button = $('themes-native-button'); + if (button) + button.disabled = !enabled; }, setThemesResetButtonEnabled_: function(enabled) { @@ -1465,7 +1466,7 @@ cr.define('options', function() { 'setAutoOpenFileTypesDisplayed', 'setBluetoothState', 'setFontSize', - 'setGtkThemeButtonEnabled', + 'setNativeThemeButtonEnabled', 'setHighContrastCheckboxState', 'setMetricsReportingCheckboxState', 'setMetricsReportingSettingVisibility', diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc index 66d6bc3..fb594d8 100644 --- a/chrome/browser/themes/theme_service.cc +++ b/chrome/browser/themes/theme_service.cc @@ -32,10 +32,6 @@ #include "ui/base/win/shell.h" #endif -#if defined(USE_AURA) && !defined(USE_ASH) && defined(OS_LINUX) -#include "ui/linux_ui/linux_ui.h" -#endif - #if defined(ENABLE_MANAGED_USERS) #include "chrome/browser/managed_mode/managed_user_service.h" #endif @@ -123,12 +119,6 @@ gfx::Image ThemeService::GetImageNamed(int id) const { if (theme_pack_.get()) image = theme_pack_->GetImageNamed(id); -#if defined(USE_AURA) && !defined(USE_ASH) && defined(OS_LINUX) - const ui::LinuxUI* linux_ui = ui::LinuxUI::instance(); - if (image.IsEmpty() && linux_ui) - image = linux_ui->GetThemeImageNamed(id); -#endif - if (image.IsEmpty()) image = rb_.GetNativeImageNamed(id); @@ -159,12 +149,6 @@ SkColor ThemeService::GetColor(int id) const { if (theme_pack_.get() && theme_pack_->GetColor(id, &color)) return color; -#if defined(USE_AURA) && !defined(USE_ASH) && defined(OS_LINUX) - const ui::LinuxUI* linux_ui = ui::LinuxUI::instance(); - if (linux_ui && linux_ui->GetColor(id, &color)) - return color; -#endif - // For backward compat with older themes, some newer colors are generated from // older ones if they are missing. switch (id) { diff --git a/chrome/browser/themes/theme_service_aurax11.cc b/chrome/browser/themes/theme_service_aurax11.cc new file mode 100644 index 0000000..fe1c3de --- /dev/null +++ b/chrome/browser/themes/theme_service_aurax11.cc @@ -0,0 +1,85 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/themes/theme_service_aurax11.h" + +#include "base/bind.h" +#include "base/prefs/pref_service.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/common/pref_names.h" +#include "ui/gfx/image/image.h" +#include "ui/linux_ui/linux_ui.h" + +ThemeServiceAuraX11::ThemeServiceAuraX11() + : use_system_theme_(false) { +} + +ThemeServiceAuraX11::~ThemeServiceAuraX11() {} + +void ThemeServiceAuraX11::Init(Profile* profile) { + registrar_.Init(profile->GetPrefs()); + registrar_.Add(prefs::kUsesSystemTheme, + base::Bind(&ThemeServiceAuraX11::OnUsesSystemThemeChanged, + base::Unretained(this))); + use_system_theme_ = profile->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); + + ThemeService::Init(profile); +} + +gfx::Image ThemeServiceAuraX11::GetImageNamed(int id) const { + const ui::LinuxUI* linux_ui = ui::LinuxUI::instance(); + if (use_system_theme_ && linux_ui) { + gfx::Image image = linux_ui->GetThemeImageNamed(id); + if (!image.IsEmpty()) + return image; + } + + return ThemeService::GetImageNamed(id); +} + +SkColor ThemeServiceAuraX11::GetColor(int id) const { + const ui::LinuxUI* linux_ui = ui::LinuxUI::instance(); + SkColor color; + if (use_system_theme_ && linux_ui && linux_ui->GetColor(id, &color)) + return color; + + return ThemeService::GetColor(id); +} + +bool ThemeServiceAuraX11::HasCustomImage(int id) const { + const ui::LinuxUI* linux_ui = ui::LinuxUI::instance(); + if (use_system_theme_ && linux_ui) + return linux_ui->HasCustomImage(id); + + return ThemeService::HasCustomImage(id); +} + +void ThemeServiceAuraX11::SetTheme(const extensions::Extension* extension) { + profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); + ThemeService::SetTheme(extension); +} + +void ThemeServiceAuraX11::UseDefaultTheme() { + profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); + ThemeService::UseDefaultTheme(); +} + +void ThemeServiceAuraX11::SetNativeTheme() { + profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, true); + ClearAllThemeData(); + NotifyThemeChanged(); +} + +bool ThemeServiceAuraX11::UsingDefaultTheme() const { + return !use_system_theme_ && ThemeService::UsingDefaultTheme(); +} + +bool ThemeServiceAuraX11::UsingNativeTheme() const { + return use_system_theme_; +} + +void ThemeServiceAuraX11::OnUsesSystemThemeChanged() { + use_system_theme_ = + profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); +} diff --git a/chrome/browser/themes/theme_service_aurax11.h b/chrome/browser/themes/theme_service_aurax11.h new file mode 100644 index 0000000..96dce92 --- /dev/null +++ b/chrome/browser/themes/theme_service_aurax11.h @@ -0,0 +1,43 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_THEMES_THEME_SERVICE_AURAX11_H_ +#define CHROME_BROWSER_THEMES_THEME_SERVICE_AURAX11_H_ + +#include "base/prefs/pref_change_registrar.h" +#include "chrome/browser/themes/theme_service.h" + +// A subclass of ThemeService that queries the current ui::LinuxUI instance for +// theme data. +class ThemeServiceAuraX11 : public ThemeService { + public: + ThemeServiceAuraX11(); + virtual ~ThemeServiceAuraX11(); + + // Overridden from ui::ThemeProvider: + virtual SkColor GetColor(int id) const OVERRIDE; + virtual bool HasCustomImage(int id) const OVERRIDE; + + // Overridden from ThemeService: + virtual void Init(Profile* profile) OVERRIDE; + virtual gfx::Image GetImageNamed(int id) const OVERRIDE; + virtual void SetTheme(const extensions::Extension* extension) OVERRIDE; + virtual void UseDefaultTheme() OVERRIDE; + virtual void SetNativeTheme() OVERRIDE; + virtual bool UsingDefaultTheme() const OVERRIDE; + virtual bool UsingNativeTheme() const OVERRIDE; + + private: + void OnUsesSystemThemeChanged(); + + // Whether we'll give the ui::LinuxUI object first shot at providing theme + // resources. + bool use_system_theme_; + + PrefChangeRegistrar registrar_; + + DISALLOW_COPY_AND_ASSIGN(ThemeServiceAuraX11); +}; + +#endif // CHROME_BROWSER_THEMES_THEME_SERVICE_AURAX11_H_ diff --git a/chrome/browser/themes/theme_service_factory.cc b/chrome/browser/themes/theme_service_factory.cc index 054d56c..adc424b7 100644 --- a/chrome/browser/themes/theme_service_factory.cc +++ b/chrome/browser/themes/theme_service_factory.cc @@ -18,6 +18,11 @@ #include "chrome/browser/ui/gtk/gtk_theme_service.h" #endif +#if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) +#include "chrome/browser/themes/theme_service_aurax11.h" +#include "ui/linux_ui/linux_ui.h" +#endif + // static ThemeService* ThemeServiceFactory::GetForProfile(Profile* profile) { return static_cast<ThemeService*>( @@ -51,6 +56,8 @@ BrowserContextKeyedService* ThemeServiceFactory::BuildServiceInstanceFor( ThemeService* provider = NULL; #if defined(TOOLKIT_GTK) provider = new GtkThemeService; +#elif defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) + provider = new ThemeServiceAuraX11; #else provider = new ThemeService; #endif @@ -61,10 +68,20 @@ BrowserContextKeyedService* ThemeServiceFactory::BuildServiceInstanceFor( void ThemeServiceFactory::RegisterUserPrefs( user_prefs::PrefRegistrySyncable* registry) { +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) + bool default_uses_system_theme = false; + #if defined(TOOLKIT_GTK) + default_uses_system_theme = GtkThemeService::DefaultUsesSystemTheme(); +#elif defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) + const ui::LinuxUI* linux_ui = ui::LinuxUI::instance(); + if (linux_ui) + default_uses_system_theme = linux_ui->GetDefaultUsesSystemTheme(); +#endif + registry->RegisterBooleanPref( prefs::kUsesSystemTheme, - GtkThemeService::DefaultUsesSystemTheme(), + default_uses_system_theme, user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); #endif registry->RegisterFilePathPref( diff --git a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc index 195460a..3243d7b 100644 --- a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc +++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc @@ -7,6 +7,7 @@ #include <set> #include "base/command_line.h" +#include "base/environment.h" #include "base/i18n/rtl.h" #include "base/logging.h" #include "base/nix/mime_util_xdg.h" @@ -342,10 +343,32 @@ bool Gtk2UI::GetColor(int id, SkColor* color) const { return false; } +bool Gtk2UI::HasCustomImage(int id) const { + return IsOverridableImage(id); +} + ui::NativeTheme* Gtk2UI::GetNativeTheme() const { return NativeThemeGtk2::instance(); } +bool Gtk2UI::GetDefaultUsesSystemTheme() const { + scoped_ptr<base::Environment> env(base::Environment::Create()); + + switch (base::nix::GetDesktopEnvironment(env.get())) { + case base::nix::DESKTOP_ENVIRONMENT_GNOME: + case base::nix::DESKTOP_ENVIRONMENT_UNITY: + case base::nix::DESKTOP_ENVIRONMENT_XFCE: + return true; + case base::nix::DESKTOP_ENVIRONMENT_KDE3: + case base::nix::DESKTOP_ENVIRONMENT_KDE4: + case base::nix::DESKTOP_ENVIRONMENT_OTHER: + return false; + } + // Unless GetDesktopEnvironment() badly misbehaves, this should never happen. + NOTREACHED(); + return false; +} + ui::SelectFileDialog* Gtk2UI::CreateSelectFileDialog( ui::SelectFileDialog::Listener* listener, ui::SelectFilePolicy* policy) const { diff --git a/chrome/browser/ui/libgtk2ui/gtk2_ui.h b/chrome/browser/ui/libgtk2ui/gtk2_ui.h index 5d1d681..760864a 100644 --- a/chrome/browser/ui/libgtk2ui/gtk2_ui.h +++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.h @@ -42,7 +42,9 @@ class Gtk2UI : public ui::LinuxUI { virtual bool UseNativeTheme() const OVERRIDE; virtual gfx::Image GetThemeImageNamed(int id) const OVERRIDE; virtual bool GetColor(int id, SkColor* color) const OVERRIDE; + virtual bool HasCustomImage(int id) const OVERRIDE; virtual ui::NativeTheme* GetNativeTheme() const OVERRIDE; + virtual bool GetDefaultUsesSystemTheme() const OVERRIDE; private: typedef std::map<int, SkColor> ColorMap; diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc index 4df68d7..a999c6b 100644 --- a/chrome/browser/ui/webui/options/browser_options_handler.cc +++ b/chrome/browser/ui/webui/options/browser_options_handler.cc @@ -114,10 +114,6 @@ #include "chrome/installer/util/auto_launch_util.h" #endif // defined(OS_WIN) -#if defined(TOOLKIT_GTK) -#include "chrome/browser/ui/gtk/gtk_theme_service.h" -#endif // defined(TOOLKIT_GTK) - using content::BrowserContext; using content::BrowserThread; using content::DownloadManager; @@ -336,9 +332,9 @@ void BrowserOptionsHandler::GetLocalizedValues(DictionaryValue* values) { { "toolbarShowHomeButton", IDS_OPTIONS_TOOLBAR_SHOW_HOME_BUTTON }, { "translateEnableTranslate", IDS_OPTIONS_TRANSLATE_ENABLE_TRANSLATE }, -#if defined(TOOLKIT_GTK) +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) { "showWindowDecorations", IDS_SHOW_WINDOW_DECORATIONS }, - { "themesGTKButton", IDS_THEMES_GTK_BUTTON }, + { "themesNativeButton", IDS_THEMES_GTK_BUTTON }, { "themesSetClassic", IDS_THEMES_SET_CLASSIC }, #else { "themes", IDS_THEMES_GROUP_NAME }, @@ -578,10 +574,10 @@ void BrowserOptionsHandler::RegisterMessages() { "themesReset", base::Bind(&BrowserOptionsHandler::ThemesReset, base::Unretained(this))); -#if defined(TOOLKIT_GTK) +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) web_ui()->RegisterMessageCallback( - "themesSetGTK", - base::Bind(&BrowserOptionsHandler::ThemesSetGTK, + "themesSetNative", + base::Bind(&BrowserOptionsHandler::ThemesSetNative, base::Unretained(this))); #endif web_ui()->RegisterMessageCallback( @@ -1319,18 +1315,19 @@ void BrowserOptionsHandler::CancelProfileRegistration(bool user_initiated) { void BrowserOptionsHandler::ObserveThemeChanged() { Profile* profile = Profile::FromWebUI(web_ui()); bool profile_is_managed = ManagedUserService::ProfileIsManaged(profile); -#if defined(TOOLKIT_GTK) - GtkThemeService* theme_service = GtkThemeService::GetFrom(profile); - bool is_gtk_theme = theme_service->UsingNativeTheme(); - base::FundamentalValue gtk_enabled(!is_gtk_theme && !profile_is_managed); - web_ui()->CallJavascriptFunction("BrowserOptions.setGtkThemeButtonEnabled", - gtk_enabled); -#else ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile); - bool is_gtk_theme = false; + bool is_native_theme = false; + +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) + is_native_theme = theme_service->UsingNativeTheme(); + base::FundamentalValue native_theme_enabled(!is_native_theme && + !profile_is_managed); + web_ui()->CallJavascriptFunction("BrowserOptions.setNativeThemeButtonEnabled", + native_theme_enabled); #endif - bool is_classic_theme = !is_gtk_theme && theme_service->UsingDefaultTheme(); + bool is_classic_theme = !is_native_theme && + theme_service->UsingDefaultTheme(); base::FundamentalValue enabled(!is_classic_theme && !profile_is_managed); web_ui()->CallJavascriptFunction("BrowserOptions.setThemesResetButtonEnabled", enabled); @@ -1344,8 +1341,8 @@ void BrowserOptionsHandler::ThemesReset(const ListValue* args) { ThemeServiceFactory::GetForProfile(profile)->UseDefaultTheme(); } -#if defined(TOOLKIT_GTK) -void BrowserOptionsHandler::ThemesSetGTK(const ListValue* args) { +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) +void BrowserOptionsHandler::ThemesSetNative(const ListValue* args) { content::RecordAction(UserMetricsAction("Options_GtkThemeSet")); Profile* profile = Profile::FromWebUI(web_ui()); ThemeServiceFactory::GetForProfile(profile)->SetNativeTheme(); diff --git a/chrome/browser/ui/webui/options/browser_options_handler.h b/chrome/browser/ui/webui/options/browser_options_handler.h index 8985d73..0967d11 100644 --- a/chrome/browser/ui/webui/options/browser_options_handler.h +++ b/chrome/browser/ui/webui/options/browser_options_handler.h @@ -194,8 +194,8 @@ class BrowserOptionsHandler void ObserveThemeChanged(); void ThemesReset(const base::ListValue* args); -#if defined(TOOLKIT_GTK) - void ThemesSetGTK(const base::ListValue* args); +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) + void ThemesSetNative(const base::ListValue* args); #endif #if defined(OS_CHROMEOS) diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index b15227b..0a780b9 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -2231,6 +2231,8 @@ 'browser/themes/theme_service_factory.cc', 'browser/themes/theme_service_factory.h', 'browser/themes/theme_service.h', + 'browser/themes/theme_service_aurax11.cc', + 'browser/themes/theme_service_aurax11.h', 'browser/themes/theme_service_gtk.cc', 'browser/themes/theme_service_mac.mm', 'browser/themes/theme_syncable_service.cc', @@ -2681,6 +2683,8 @@ 'browser/storage_monitor/mtab_watcher_linux.h', 'browser/storage_monitor/storage_monitor_linux.cc', 'browser/storage_monitor/storage_monitor_linux.h', + 'browser/themes/theme_service_aurax11.cc', + 'browser/themes/theme_service_aurax11.h', 'browser/ui/webui/help/version_updater_basic.cc', 'browser/ui/webui/help/version_updater_basic.h', 'browser/upgrade_detector_impl.cc', diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 6490722..98beae0 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -955,8 +955,8 @@ const char kAllowDeletingBrowserHistory[] = "history.deleting_enabled"; // Boolean controlling whether SafeSearch is mandatory for Google Web Searches. const char kForceSafeSearch[] = "settings.force_safesearch"; -#if defined(TOOLKIT_GTK) -// GTK specific preference on whether we should match the system GTK theme. +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) +// Linux specific preference on whether we should match the system theme. const char kUsesSystemTheme[] = "extensions.theme.use_system"; #endif const char kCurrentThemePackFilename[] = "extensions.theme.pack"; diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index d2c97b6..7b1bb7b 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -341,7 +341,7 @@ extern const char kAllowDeletingBrowserHistory[]; extern const char kForceSafeSearch[]; extern const char kDeleteTimePeriod[]; extern const char kLastClearBrowsingDataTime[]; -#if defined(TOOLKIT_GTK) +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) extern const char kUsesSystemTheme[]; #endif extern const char kCurrentThemePackFilename[]; diff --git a/ui/linux_ui/linux_ui.h b/ui/linux_ui/linux_ui.h index 85decc8..1f58e11 100644 --- a/ui/linux_ui/linux_ui.h +++ b/ui/linux_ui/linux_ui.h @@ -47,10 +47,15 @@ class LINUX_UI_EXPORT LinuxUI : public LinuxShellDialog { virtual bool UseNativeTheme() const = 0; virtual gfx::Image GetThemeImageNamed(int id) const = 0; virtual bool GetColor(int id, SkColor* color) const = 0; + virtual bool HasCustomImage(int id) const = 0; // Returns a NativeTheme that will provide system colors and draw system // style widgets. virtual NativeTheme* GetNativeTheme() const = 0; + + // Returns whether we should be using the native theme provided by this + // object by default. + virtual bool GetDefaultUsesSystemTheme() const = 0; }; } // namespace ui diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc index ea98a9c..78d3e9d 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc @@ -619,6 +619,10 @@ bool DesktopRootWindowHostX11::ShouldUseNativeFrame() { } void DesktopRootWindowHostX11::FrameTypeChanged() { + // Replace the frame and layout the contents. Even though we don't have a + // swapable glass frame like on Windows, we still replace the frame because + // the button assets don't update otherwise. + native_widget_delegate_->AsWidget()->non_client_view()->UpdateFrame(true); } NonClientFrameView* DesktopRootWindowHostX11::CreateNonClientFrameView() { |