summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authormdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-20 23:14:57 +0000
committermdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-20 23:14:57 +0000
commitc85cfbd98c6bf26e730fdd15538c624cb52352e9 (patch)
tree55c7af76f8cfcd1cccee33ebdc5e087543d938fc /base
parent11783f0ab7285b59c4fd40c42bbbf74fcea916e4 (diff)
downloadchromium_src-c85cfbd98c6bf26e730fdd15538c624cb52352e9.zip
chromium_src-c85cfbd98c6bf26e730fdd15538c624cb52352e9.tar.gz
chromium_src-c85cfbd98c6bf26e730fdd15538c624cb52352e9.tar.bz2
Linux: make the "change proxy settings" button able to start several proxy config utilities.
Currently it still only ever starts gnome-network-properties but it is now easy to update. BUG=none TEST=none Review URL: http://codereview.chromium.org/174106 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23910 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/linux_util.cc28
-rw-r--r--base/linux_util.h11
2 files changed, 35 insertions, 4 deletions
diff --git a/base/linux_util.cc b/base/linux_util.cc
index 259899f..7bdab94 100644
--- a/base/linux_util.cc
+++ b/base/linux_util.cc
@@ -104,8 +104,10 @@ DesktopEnvironment GetDesktopEnvironment(EnvironmentVariableGetter* env) {
if (env->Getenv("DESKTOP_SESSION", &desktop_session)) {
if (desktop_session == "gnome")
return DESKTOP_ENVIRONMENT_GNOME;
- else if (desktop_session.substr(3) == "kde") // kde3 or kde4
- return DESKTOP_ENVIRONMENT_KDE;
+ else if (desktop_session == "kde4")
+ return DESKTOP_ENVIRONMENT_KDE4;
+ else if (desktop_session == "kde")
+ return DESKTOP_ENVIRONMENT_KDE3;
}
// Fall back on some older environment variables.
@@ -114,10 +116,30 @@ DesktopEnvironment GetDesktopEnvironment(EnvironmentVariableGetter* env) {
if (env->Getenv("GNOME_DESKTOP_SESSION_ID", &dummy)) {
return DESKTOP_ENVIRONMENT_GNOME;
} else if (env->Getenv("KDE_FULL_SESSION", &dummy)) {
- return DESKTOP_ENVIRONMENT_KDE;
+ if (env->Getenv("KDE_SESSION_VERSION", &dummy))
+ return DESKTOP_ENVIRONMENT_KDE4;
+ return DESKTOP_ENVIRONMENT_KDE3;
}
return DESKTOP_ENVIRONMENT_OTHER;
}
+const char* GetDesktopEnvironmentName(DesktopEnvironment env) {
+ switch (env) {
+ case DESKTOP_ENVIRONMENT_OTHER:
+ return NULL;
+ case DESKTOP_ENVIRONMENT_GNOME:
+ return "GNOME";
+ case DESKTOP_ENVIRONMENT_KDE3:
+ return "KDE3";
+ case DESKTOP_ENVIRONMENT_KDE4:
+ return "KDE4";
+ }
+ return NULL;
+}
+
+const char* GetDesktopEnvironmentName(EnvironmentVariableGetter* env) {
+ return GetDesktopEnvironmentName(GetDesktopEnvironment(env));
+}
+
} // namespace base
diff --git a/base/linux_util.h b/base/linux_util.h
index 693377c..4cfa9da 100644
--- a/base/linux_util.h
+++ b/base/linux_util.h
@@ -35,7 +35,10 @@ class EnvironmentVariableGetter {
enum DesktopEnvironment {
DESKTOP_ENVIRONMENT_OTHER,
DESKTOP_ENVIRONMENT_GNOME,
- DESKTOP_ENVIRONMENT_KDE,
+ // KDE3 and KDE4 are sufficiently different that we count
+ // them as two different desktop environments here.
+ DESKTOP_ENVIRONMENT_KDE3,
+ DESKTOP_ENVIRONMENT_KDE4,
};
// Return an entry from the DesktopEnvironment enum with a best guess
@@ -44,6 +47,12 @@ enum DesktopEnvironment {
// proxy settings, password manager, etc.
DesktopEnvironment GetDesktopEnvironment(EnvironmentVariableGetter* env);
+// Return a string representation of the given desktop environment.
+// May return NULL in the case of DESKTOP_ENVIRONMENT_OTHER.
+const char* GetDesktopEnvironmentName(DesktopEnvironment env);
+// Convenience wrapper that calls GetDesktopEnvironment() first.
+const char* GetDesktopEnvironmentName(EnvironmentVariableGetter* env);
+
} // namespace base
#endif // BASE_LINUX_UTIL_H__