OLD | NEW |
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 linux_distro = output.substr(field.length()); | 52 linux_distro = output.substr(field.length()); |
53 } | 53 } |
54 // We do this check only once per process. If it fails, there's | 54 // We do this check only once per process. If it fails, there's |
55 // little reason to believe it will work if we attempt to run | 55 // little reason to believe it will work if we attempt to run |
56 // lsb_release again. | 56 // lsb_release again. |
57 checked_distro = true; | 57 checked_distro = true; |
58 } | 58 } |
59 return linux_distro; | 59 return linux_distro; |
60 } | 60 } |
61 | 61 |
| 62 bool UseGnomeForSettings() { |
| 63 // GNOME_DESKTOP_SESSION_ID being defined is a good indication that |
| 64 // we are probably running under GNOME. |
| 65 // Note: KDE_FULL_SESSION is a corresponding env var to recognize KDE. |
| 66 char* desktop_session; |
| 67 return (getenv("GNOME_DESKTOP_SESSION_ID") || |
| 68 ((desktop_session = getenv("DESKTOP_SESSION")) && |
| 69 std::string(desktop_session) == "gnome")); |
| 70 } |
| 71 |
62 } // namespace base | 72 } // namespace base |
OLD | NEW |