summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-26 20:04:06 +0000
committererg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-26 20:04:06 +0000
commit88c50ab803907cb0ea0c7acc14f94dbb267d473f (patch)
treedde8db67ef4e94abc64f700adc38cfdc1a88a9d6
parent5a9b083b725c8f9b40ad53ad6cc0f97e8f6d211b (diff)
downloadchromium_src-88c50ab803907cb0ea0c7acc14f94dbb267d473f.zip
chromium_src-88c50ab803907cb0ea0c7acc14f94dbb267d473f.tar.gz
chromium_src-88c50ab803907cb0ea0c7acc14f94dbb267d473f.tar.bz2
GTK: Turn on the GTK+ integration by default.
This will regress default startup time for users by 50ms. This doesn't matter because this is what the users want--I've lost count of the number bloggers, people on twitter, and people in our IRC channel complaining about the lack of GTK+ integration...when it's just not on by default. BUG=none TEST=none Review URL: http://codereview.chromium.org/1442001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42804 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/linux_util.cc4
-rw-r--r--base/linux_util.h1
-rw-r--r--chrome/browser/gtk/gtk_theme_provider.cc16
-rw-r--r--chrome/browser/gtk/gtk_theme_provider.h4
-rw-r--r--chrome/browser/gtk/options/advanced_contents_gtk.cc1
-rw-r--r--chrome/browser/profile.cc3
-rw-r--r--chrome/test/data/profiles/chrome_prefs/Preferences5
-rw-r--r--chrome/test/data/profiles/custom_frame/Default/Preferences5
-rw-r--r--chrome/test/data/profiles/sample/Preferences9
-rw-r--r--chrome/test/data/profiles/typical_history/Default/Preferences5
-rw-r--r--net/proxy/proxy_config_service_linux.cc1
11 files changed, 52 insertions, 2 deletions
diff --git a/base/linux_util.cc b/base/linux_util.cc
index 14c355e..e49a01f 100644
--- a/base/linux_util.cc
+++ b/base/linux_util.cc
@@ -274,6 +274,8 @@ DesktopEnvironment GetDesktopEnvironment(EnvironmentVariableGetter* env) {
return DESKTOP_ENVIRONMENT_KDE4;
return DESKTOP_ENVIRONMENT_KDE3;
}
+ else if (desktop_session == "xfce4")
+ return DESKTOP_ENVIRONMENT_XFCE;
}
// Fall back on some older environment variables.
@@ -300,6 +302,8 @@ const char* GetDesktopEnvironmentName(DesktopEnvironment env) {
return "KDE3";
case DESKTOP_ENVIRONMENT_KDE4:
return "KDE4";
+ case DESKTOP_ENVIRONMENT_XFCE:
+ return "XFCE";
}
return NULL;
}
diff --git a/base/linux_util.h b/base/linux_util.h
index b62f7cc..2139746 100644
--- a/base/linux_util.h
+++ b/base/linux_util.h
@@ -61,6 +61,7 @@ enum DesktopEnvironment {
// them as two different desktop environments here.
DESKTOP_ENVIRONMENT_KDE3,
DESKTOP_ENVIRONMENT_KDE4,
+ DESKTOP_ENVIRONMENT_XFCE,
};
// Return an entry from the DesktopEnvironment enum with a best guess
diff --git a/chrome/browser/gtk/gtk_theme_provider.cc b/chrome/browser/gtk/gtk_theme_provider.cc
index 4a229c6..6494657 100644
--- a/chrome/browser/gtk/gtk_theme_provider.cc
+++ b/chrome/browser/gtk/gtk_theme_provider.cc
@@ -7,6 +7,7 @@
#include <gtk/gtk.h>
#include "app/resource_bundle.h"
+#include "base/linux_util.h"
#include "base/stl_util-inl.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/profile.h"
@@ -399,6 +400,21 @@ GdkPixbuf* GtkThemeProvider::GetDefaultFavicon(bool native) {
static GdkPixbuf* default_bookmark_icon_ = rb.GetPixbufNamed(
IDR_DEFAULT_FAVICON);
return default_bookmark_icon_;
+
+}
+
+// static
+bool GtkThemeProvider::DefaultUsesSystemTheme() {
+ scoped_ptr<base::EnvironmentVariableGetter> env_getter(
+ base::EnvironmentVariableGetter::Create());
+
+ switch (base::GetDesktopEnvironment(env_getter.get())) {
+ case base::DESKTOP_ENVIRONMENT_GNOME:
+ case base::DESKTOP_ENVIRONMENT_XFCE:
+ return true;
+ default:
+ return false;
+ }
}
void GtkThemeProvider::ClearAllThemeData() {
diff --git a/chrome/browser/gtk/gtk_theme_provider.h b/chrome/browser/gtk/gtk_theme_provider.h
index c5a8b5e..23c0a57 100644
--- a/chrome/browser/gtk/gtk_theme_provider.h
+++ b/chrome/browser/gtk/gtk_theme_provider.h
@@ -108,6 +108,10 @@ class GtkThemeProvider : public BrowserThemeProvider,
static GdkPixbuf* GetFolderIcon(bool native);
static GdkPixbuf* GetDefaultFavicon(bool native);
+ // Whether we use the GTK theme by default in the current desktop
+ // environment. Returns true when we GTK defaults to on.
+ static bool DefaultUsesSystemTheme();
+
private:
typedef std::map<int, SkColor> ColorMap;
typedef std::map<int, color_utils::HSL> TintMap;
diff --git a/chrome/browser/gtk/options/advanced_contents_gtk.cc b/chrome/browser/gtk/options/advanced_contents_gtk.cc
index 9a1f01b..61dddb3 100644
--- a/chrome/browser/gtk/options/advanced_contents_gtk.cc
+++ b/chrome/browser/gtk/options/advanced_contents_gtk.cc
@@ -420,6 +420,7 @@ void NetworkSection::OnChangeProxiesButtonClicked(GtkButton *button,
found_command = SearchPATH(&command, 1, NULL);
break;
+ case base::DESKTOP_ENVIRONMENT_XFCE:
case base::DESKTOP_ENVIRONMENT_OTHER:
break;
}
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 802ad29..b6a8716 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -155,7 +155,8 @@ void Profile::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterBooleanPref(prefs::kEnableSpellCheck, true);
prefs->RegisterBooleanPref(prefs::kEnableAutoSpellCorrect, true);
#if defined(TOOLKIT_USES_GTK)
- prefs->RegisterBooleanPref(prefs::kUsesSystemTheme, false);
+ prefs->RegisterBooleanPref(prefs::kUsesSystemTheme,
+ GtkThemeProvider::DefaultUsesSystemTheme());
#endif
prefs->RegisterFilePathPref(prefs::kCurrentThemePackFilename, FilePath());
prefs->RegisterStringPref(prefs::kCurrentThemeID,
diff --git a/chrome/test/data/profiles/chrome_prefs/Preferences b/chrome/test/data/profiles/chrome_prefs/Preferences
index 937b1e39..4510e2f 100644
--- a/chrome/test/data/profiles/chrome_prefs/Preferences
+++ b/chrome/test/data/profiles/chrome_prefs/Preferences
@@ -1,4 +1,9 @@
{
+ "extensions": {
+ "theme": {
+ "use_system": false
+ }
+ },
"intl": {
"charset_default": "utf8"
},
diff --git a/chrome/test/data/profiles/custom_frame/Default/Preferences b/chrome/test/data/profiles/custom_frame/Default/Preferences
index 26dc297..d9929da 100644
--- a/chrome/test/data/profiles/custom_frame/Default/Preferences
+++ b/chrome/test/data/profiles/custom_frame/Default/Preferences
@@ -1,4 +1,9 @@
{
+ "extensions": {
+ "theme": {
+ "use_system": false
+ }
+ },
"browser": {
"custom_chrome_frame": true
},
diff --git a/chrome/test/data/profiles/sample/Preferences b/chrome/test/data/profiles/sample/Preferences
index 19765bd..6e9ca31 100644
--- a/chrome/test/data/profiles/sample/Preferences
+++ b/chrome/test/data/profiles/sample/Preferences
@@ -1 +1,8 @@
-null
+{
+ "extensions": {
+ "theme": {
+ "use_system": false
+ }
+ }
+}
+
diff --git a/chrome/test/data/profiles/typical_history/Default/Preferences b/chrome/test/data/profiles/typical_history/Default/Preferences
index e56c782..a924d9c 100644
--- a/chrome/test/data/profiles/typical_history/Default/Preferences
+++ b/chrome/test/data/profiles/typical_history/Default/Preferences
@@ -1,4 +1,9 @@
{
+ "extensions": {
+ "theme": {
+ "use_system": false
+ }
+ },
"profile": {
"exited_cleanly": true,
"id": "not-signed-in",
diff --git a/net/proxy/proxy_config_service_linux.cc b/net/proxy/proxy_config_service_linux.cc
index c1d18dd..a43a7e8 100644
--- a/net/proxy/proxy_config_service_linux.cc
+++ b/net/proxy/proxy_config_service_linux.cc
@@ -974,6 +974,7 @@ ProxyConfigServiceLinux::Delegate::Delegate(
case base::DESKTOP_ENVIRONMENT_KDE4:
gconf_getter_.reset(new GConfSettingGetterImplKDE(env_var_getter));
break;
+ case base::DESKTOP_ENVIRONMENT_XFCE:
case base::DESKTOP_ENVIRONMENT_OTHER:
break;
}