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

Unified Diff: chrome/browser/profile.cc

Issue 150176: GTK: First draft of using native themes, partially based on evan's CL 118358. (Closed)
Patch Set: And the codereview tool is back. Created 11 years, 6 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
Index: chrome/browser/profile.cc
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 5d0ccecec2d9ff4fea4edf8158365baf0cfb9c6b..0034792cd2c684137000baf7546a5e06e5c5c6aa 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<BrowserThemeProvider> themes(new GtkThemeProvider);
tony 2009/07/07 19:47:05 Nit: Maybe make a static ::Create method to avoid
+#else
scoped_refptr<BrowserThemeProvider> 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();

Powered by Google App Engine
This is Rietveld 408576698