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 #ifndef BASE_LINUX_UTIL_H__ | 5 #ifndef BASE_LINUX_UTIL_H__ |
6 #define BASE_LINUX_UTIL_H__ | 6 #define BASE_LINUX_UTIL_H__ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 17 matching lines...) Expand all Loading... |
28 // result. Returns false if the key is unset. | 28 // result. Returns false if the key is unset. |
29 virtual bool Getenv(const char* variable_name, std::string* result) = 0; | 29 virtual bool Getenv(const char* variable_name, std::string* result) = 0; |
30 | 30 |
31 // Create an instance of EnvironmentVariableGetter | 31 // Create an instance of EnvironmentVariableGetter |
32 static EnvironmentVariableGetter* Create(); | 32 static EnvironmentVariableGetter* Create(); |
33 }; | 33 }; |
34 | 34 |
35 enum DesktopEnvironment { | 35 enum DesktopEnvironment { |
36 DESKTOP_ENVIRONMENT_OTHER, | 36 DESKTOP_ENVIRONMENT_OTHER, |
37 DESKTOP_ENVIRONMENT_GNOME, | 37 DESKTOP_ENVIRONMENT_GNOME, |
38 DESKTOP_ENVIRONMENT_KDE, | 38 // KDE3 and KDE4 are sufficiently different that we count |
| 39 // them as two different desktop environments here. |
| 40 DESKTOP_ENVIRONMENT_KDE3, |
| 41 DESKTOP_ENVIRONMENT_KDE4, |
39 }; | 42 }; |
40 | 43 |
41 // Return an entry from the DesktopEnvironment enum with a best guess | 44 // Return an entry from the DesktopEnvironment enum with a best guess |
42 // of which desktop environment we're using. We use this to know when | 45 // of which desktop environment we're using. We use this to know when |
43 // to attempt to use preferences from the desktop environment -- | 46 // to attempt to use preferences from the desktop environment -- |
44 // proxy settings, password manager, etc. | 47 // proxy settings, password manager, etc. |
45 DesktopEnvironment GetDesktopEnvironment(EnvironmentVariableGetter* env); | 48 DesktopEnvironment GetDesktopEnvironment(EnvironmentVariableGetter* env); |
46 | 49 |
| 50 // Return a string representation of the given desktop environment. |
| 51 // May return NULL in the case of DESKTOP_ENVIRONMENT_OTHER. |
| 52 const char* GetDesktopEnvironmentName(DesktopEnvironment env); |
| 53 // Convenience wrapper that calls GetDesktopEnvironment() first. |
| 54 const char* GetDesktopEnvironmentName(EnvironmentVariableGetter* env); |
| 55 |
47 } // namespace base | 56 } // namespace base |
48 | 57 |
49 #endif // BASE_LINUX_UTIL_H__ | 58 #endif // BASE_LINUX_UTIL_H__ |
OLD | NEW |