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

Side by Side Diff: base/linux_util.cc

Issue 427013: Properly detect KDE4 on newer systems (e.g. [K]Ubuntu 9.04). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | Annotate | Revision Log
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 <dirent.h> 7 #include <dirent.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <sys/stat.h> 10 #include <sys/stat.h>
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 return new EnvironmentVariableGetterImpl(); 220 return new EnvironmentVariableGetterImpl();
221 } 221 }
222 222
223 DesktopEnvironment GetDesktopEnvironment(EnvironmentVariableGetter* env) { 223 DesktopEnvironment GetDesktopEnvironment(EnvironmentVariableGetter* env) {
224 std::string desktop_session; 224 std::string desktop_session;
225 if (env->Getenv("DESKTOP_SESSION", &desktop_session)) { 225 if (env->Getenv("DESKTOP_SESSION", &desktop_session)) {
226 if (desktop_session == "gnome") 226 if (desktop_session == "gnome")
227 return DESKTOP_ENVIRONMENT_GNOME; 227 return DESKTOP_ENVIRONMENT_GNOME;
228 else if (desktop_session == "kde4") 228 else if (desktop_session == "kde4")
229 return DESKTOP_ENVIRONMENT_KDE4; 229 return DESKTOP_ENVIRONMENT_KDE4;
230 else if (desktop_session == "kde") 230 else if (desktop_session == "kde") {
231 // This may mean KDE4 on newer systems, so we have to check.
232 std::string dummy;
233 if (env->Getenv("KDE_SESSION_VERSION", &dummy))
Evan Martin 2009/11/21 18:31:58 We should really fix Getenv to accept a NULL argum
Lei Zhang 2009/11/25 03:07:52 On my Kubuntu 9.04 box, KDE_SESSION_VERSION=4. Sho
Mike Mammarella 2009/11/25 09:35:53 My reasoning was that if we check for its value, t
234 return DESKTOP_ENVIRONMENT_KDE4;
231 return DESKTOP_ENVIRONMENT_KDE3; 235 return DESKTOP_ENVIRONMENT_KDE3;
236 }
232 } 237 }
233 238
234 // Fall back on some older environment variables. 239 // Fall back on some older environment variables.
235 // Useful particularly in the DESKTOP_SESSION=default case. 240 // Useful particularly in the DESKTOP_SESSION=default case.
236 std::string dummy; 241 std::string dummy;
237 if (env->Getenv("GNOME_DESKTOP_SESSION_ID", &dummy)) { 242 if (env->Getenv("GNOME_DESKTOP_SESSION_ID", &dummy)) {
238 return DESKTOP_ENVIRONMENT_GNOME; 243 return DESKTOP_ENVIRONMENT_GNOME;
239 } else if (env->Getenv("KDE_FULL_SESSION", &dummy)) { 244 } else if (env->Getenv("KDE_FULL_SESSION", &dummy)) {
240 if (env->Getenv("KDE_SESSION_VERSION", &dummy)) 245 if (env->Getenv("KDE_SESSION_VERSION", &dummy))
241 return DESKTOP_ENVIRONMENT_KDE4; 246 return DESKTOP_ENVIRONMENT_KDE4;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 } 334 }
330 } 335 }
331 336
332 closedir(fd); 337 closedir(fd);
333 } 338 }
334 339
335 return already_found; 340 return already_found;
336 } 341 }
337 342
338 } // namespace base 343 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | net/proxy/proxy_config_service_linux_unittest.cc » ('j') | net/proxy/proxy_config_service_linux_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698