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

Side by Side Diff: base/linux_util.cc

Issue 159297: linux: generalize desktop environment guessing to encompass KDE (Closed)
Patch Set: fixed Created 11 years, 5 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 unified diff | Download patch
« no previous file with comments | « base/linux_util.h ('k') | chrome/browser/gtk/options/advanced_contents_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/linux_util.h" 5 #include "base/linux_util.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 checked_distro = true; 92 checked_distro = true;
93 } 93 }
94 return linux_distro; 94 return linux_distro;
95 } 95 }
96 96
97 // static 97 // static
98 EnvironmentVariableGetter* EnvironmentVariableGetter::Create() { 98 EnvironmentVariableGetter* EnvironmentVariableGetter::Create() {
99 return new EnvironmentVariableGetterImpl(); 99 return new EnvironmentVariableGetterImpl();
100 } 100 }
101 101
102 bool UseGnomeForSettings(EnvironmentVariableGetter* env_var_getter) { 102 DesktopEnvironment GetDesktopEnvironment(EnvironmentVariableGetter* env) {
103 // GNOME_DESKTOP_SESSION_ID being defined is a good indication that 103 std::string desktop_session;
104 // we are probably running under GNOME. 104 if (env->Getenv("DESKTOP_SESSION", &desktop_session)) {
105 // Note: KDE_FULL_SESSION is a corresponding env var to recognize KDE. 105 if (desktop_session == "gnome")
106 std::string dummy, desktop_session; 106 return DESKTOP_ENVIRONMENT_GNOME;
107 return env_var_getter->Getenv("GNOME_DESKTOP_SESSION_ID", &dummy) 107 else if (desktop_session.substr(3) == "kde") // kde3 or kde4
108 || (env_var_getter->Getenv("DESKTOP_SESSION", &desktop_session) 108 return DESKTOP_ENVIRONMENT_KDE;
109 && desktop_session == "gnome"); 109 }
110
111 // Fall back on some older environment variables.
112 // Useful particularly in the DESKTOP_SESSION=default case.
113 std::string dummy;
114 if (env->Getenv("GNOME_DESKTOP_SESSION_ID", &dummy)) {
115 return DESKTOP_ENVIRONMENT_GNOME;
116 } else if (env->Getenv("KDE_FULL_SESSION", &dummy)) {
117 return DESKTOP_ENVIRONMENT_KDE;
118 }
119
120 return DESKTOP_ENVIRONMENT_OTHER;
110 } 121 }
111 122
112 } // namespace base 123 } // namespace base
OLDNEW
« no previous file with comments | « base/linux_util.h ('k') | chrome/browser/gtk/options/advanced_contents_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698