From a5166af69628552e4bcf746a38f3710cc895eac3 Mon Sep 17 00:00:00 2001 From: "erg@google.com" Date: Fri, 3 Jul 2009 00:42:29 +0000 Subject: GTK: Initial implementation of using GTK themes, partially based on evan's CL 118358. A lot of stuff works: - Colors are picked out of the GTK theme. - Buttons use the current GTK button theme. - We use the user's icon theme. A lot of stuff doesn't: - We could do a better job of picking colors for the skylines. - The omnibox hasn't been touched. - UI that's not part of the toolbar hasn't been touched. - We currently fail on themes like HighContrastInverse. TEST=Under Options>Personal Stuff, click GTK Theme. Colors and widgets should be rendered with the current GTK theme stuff. TEST=With chrome open and in GTK Theme mode, change your GTK theme or icon theme. chrome should pick up on the change immediately and reimport the colors and images. http://crbug.com/13967 Review URL: http://codereview.chromium.org/150176 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19868 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/profile.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'chrome/browser/profile.cc') diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc index 5d0ccec..0034792 100644 --- a/chrome/browser/profile.cc +++ b/chrome/browser/profile.cc @@ -45,6 +45,10 @@ #include "grit/locale_settings.h" #include "net/base/force_tls_state.h" +#if defined(OS_LINUX) +#include "chrome/browser/gtk/gtk_theme_provider.h" +#endif + using base::Time; using base::TimeDelta; @@ -116,6 +120,9 @@ void Profile::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(prefs::kEnableSpellCheck, true); prefs->RegisterBooleanPref(prefs::kEnableAutoSpellCorrect, true); prefs->RegisterBooleanPref(prefs::kEnableUserScripts, false); +#if defined(OS_LINUX) + prefs->RegisterBooleanPref(prefs::kUsesSystemTheme, false); +#endif prefs->RegisterStringPref(prefs::kCurrentThemeID, L""); prefs->RegisterDictionaryPref(prefs::kCurrentThemeImages); prefs->RegisterDictionaryPref(prefs::kCurrentThemeColors); @@ -287,6 +294,10 @@ class OffTheRecordProfileImpl : public Profile, GetOriginalProfile()->SetTheme(extension); } + virtual void SetNativeTheme() { + GetOriginalProfile()->SetNativeTheme(); + } + virtual void ClearTheme() { GetOriginalProfile()->ClearTheme(); } @@ -922,7 +933,11 @@ bool ProfileImpl::HasCreatedDownloadManager() const { void ProfileImpl::InitThemes() { if (!created_theme_provider_) { +#if defined(OS_LINUX) + scoped_refptr themes(new GtkThemeProvider); +#else scoped_refptr themes(new BrowserThemeProvider); +#endif themes->Init(this); created_theme_provider_ = true; theme_provider_.swap(themes); @@ -934,6 +949,11 @@ void ProfileImpl::SetTheme(Extension* extension) { theme_provider_.get()->SetTheme(extension); } +void ProfileImpl::SetNativeTheme() { + InitThemes(); + theme_provider_.get()->SetNativeTheme(); +} + void ProfileImpl::ClearTheme() { InitThemes(); theme_provider_.get()->UseDefaultTheme(); -- cgit v1.1