summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authormattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-17 23:28:08 +0000
committermattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-17 23:28:08 +0000
commit425be73ff46ed6961322f7f412a2d403b371fc69 (patch)
tree5b2148b4d77238cefbef409b3390e120144ec0d3 /base
parent85b893f08d534d5146d94de1863a4e0ac0cbf75c (diff)
downloadchromium_src-425be73ff46ed6961322f7f412a2d403b371fc69.zip
chromium_src-425be73ff46ed6961322f7f412a2d403b371fc69.tar.gz
chromium_src-425be73ff46ed6961322f7f412a2d403b371fc69.tar.bz2
Add proxy config (using gnome-network-preferences)
BUG=11507 TEST=Open options, click change proxy, gnome-network-preferences should launch. If gnome isn't installed, LinuxProxyConfig wiki page should load. Review URL: http://codereview.chromium.org/149785 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21023 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/linux_util.cc10
-rw-r--r--base/linux_util.h6
2 files changed, 16 insertions, 0 deletions
diff --git a/base/linux_util.cc b/base/linux_util.cc
index 604980b..d8b36ed 100644
--- a/base/linux_util.cc
+++ b/base/linux_util.cc
@@ -59,4 +59,14 @@ std::string GetLinuxDistro() {
return linux_distro;
}
+bool UseGnomeForSettings() {
+ // GNOME_DESKTOP_SESSION_ID being defined is a good indication that
+ // we are probably running under GNOME.
+ // Note: KDE_FULL_SESSION is a corresponding env var to recognize KDE.
+ char* desktop_session;
+ return (getenv("GNOME_DESKTOP_SESSION_ID") ||
+ ((desktop_session = getenv("DESKTOP_SESSION")) &&
+ std::string(desktop_session) == "gnome"));
+}
+
} // namespace base
diff --git a/base/linux_util.h b/base/linux_util.h
index 973a2b0..75b4ad4 100644
--- a/base/linux_util.h
+++ b/base/linux_util.h
@@ -20,6 +20,12 @@ uint8_t* BGRAToRGBA(const uint8_t* pixels, int width, int height, int stride);
// GetWinVersion() in base/win_util.h.
std::string GetLinuxDistro();
+// Return true if we appear to be running under Gnome and should attempt to use
+// some prefrences from the desktop environment (eg proxy settings),
+// If someone adds support for other environments, this function could be
+// replaced with one that returns an enum so we an specify Gnome, KDE, etc.
+bool UseGnomeForSettings();
+
} // namespace base
#endif // BASE_LINUX_UTIL_H__