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

Side by Side Diff: base/linux_util.cc

Issue 1572042: GTK: Improve xfce detection. (Closed)
Patch Set: Add unit tests Created 10 years, 8 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <dirent.h> 7 #include <dirent.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <glib.h> 9 #include <glib.h>
10 #include <stdlib.h> 10 #include <stdlib.h>
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 FilePath rv(xdg_dir); 222 FilePath rv(xdg_dir);
223 free(xdg_dir); 223 free(xdg_dir);
224 return rv; 224 return rv;
225 } 225 }
226 return GetHomeDir(env).Append(fallback_dir); 226 return GetHomeDir(env).Append(fallback_dir);
227 } 227 }
228 228
229 DesktopEnvironment GetDesktopEnvironment(EnvVarGetter* env) { 229 DesktopEnvironment GetDesktopEnvironment(EnvVarGetter* env) {
230 std::string desktop_session; 230 std::string desktop_session;
231 if (env->GetEnv("DESKTOP_SESSION", &desktop_session)) { 231 if (env->GetEnv("DESKTOP_SESSION", &desktop_session)) {
232 if (desktop_session == "gnome") 232 if (desktop_session == "gnome") {
233 return DESKTOP_ENVIRONMENT_GNOME; 233 return DESKTOP_ENVIRONMENT_GNOME;
234 else if (desktop_session == "kde4") 234 } else if (desktop_session == "kde4") {
235 return DESKTOP_ENVIRONMENT_KDE4; 235 return DESKTOP_ENVIRONMENT_KDE4;
236 else if (desktop_session == "kde") { 236 } else if (desktop_session == "kde") {
237 // This may mean KDE4 on newer systems, so we have to check. 237 // This may mean KDE4 on newer systems, so we have to check.
238 if (env->HasEnv("KDE_SESSION_VERSION")) 238 if (env->HasEnv("KDE_SESSION_VERSION"))
239 return DESKTOP_ENVIRONMENT_KDE4; 239 return DESKTOP_ENVIRONMENT_KDE4;
Evan Martin 2010/04/15 19:31:00 I wonder if this means we break on KDE5. (Please
240 return DESKTOP_ENVIRONMENT_KDE3; 240 return DESKTOP_ENVIRONMENT_KDE3;
241 } else if (desktop_session.find("xfce") != std::string::npos) {
242 return DESKTOP_ENVIRONMENT_XFCE;
241 } 243 }
242 else if (desktop_session == "xfce4")
243 return DESKTOP_ENVIRONMENT_XFCE;
244 } 244 }
245 245
246 // Fall back on some older environment variables. 246 // Fall back on some older environment variables.
247 // Useful particularly in the DESKTOP_SESSION=default case. 247 // Useful particularly in the DESKTOP_SESSION=default case.
248 if (env->HasEnv("GNOME_DESKTOP_SESSION_ID")) { 248 if (env->HasEnv("GNOME_DESKTOP_SESSION_ID")) {
249 return DESKTOP_ENVIRONMENT_GNOME; 249 return DESKTOP_ENVIRONMENT_GNOME;
250 } else if (env->HasEnv("KDE_FULL_SESSION")) { 250 } else if (env->HasEnv("KDE_FULL_SESSION")) {
251 if (env->HasEnv("KDE_SESSION_VERSION")) 251 if (env->HasEnv("KDE_SESSION_VERSION"))
252 return DESKTOP_ENVIRONMENT_KDE4; 252 return DESKTOP_ENVIRONMENT_KDE4;
253 return DESKTOP_ENVIRONMENT_KDE3; 253 return DESKTOP_ENVIRONMENT_KDE3;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 } 342 }
343 } 343 }
344 344
345 closedir(fd); 345 closedir(fd);
346 } 346 }
347 347
348 return already_found; 348 return already_found;
349 } 349 }
350 350
351 } // namespace base 351 } // namespace base
OLDNEW
« no previous file with comments | « base/linux_util.h ('k') | base/linux_util_unittest.cc » ('j') | base/linux_util_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698