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

Side by Side Diff: base/xdg_util.h

Issue 3052034: base: Rename EnvVarGetter to Environment. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: review Created 10 years, 4 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 #ifndef BASE_XDG_UTIL_H_ 5 #ifndef BASE_XDG_UTIL_H_
6 #define BASE_XDG_UTIL_H_ 6 #define BASE_XDG_UTIL_H_
7 #pragma once 7 #pragma once
8 8
9 // XDG refers to http://en.wikipedia.org/wiki/Freedesktop.org . 9 // XDG refers to http://en.wikipedia.org/wiki/Freedesktop.org .
10 // This file contains utilities found across free desktop 10 // This file contains utilities found across free desktop
11 // environments. 11 // environments.
12 12
13 class FilePath; 13 class FilePath;
14 14
15 namespace base { 15 namespace base {
16 16
17 class EnvVarGetter; 17 class Environment;
18 18
19 // Utility function for getting XDG directories. 19 // Utility function for getting XDG directories.
20 // |env_name| is the name of an environment variable that we want to use to get 20 // |env_name| is the name of an environment variable that we want to use to get
21 // a directory path. |fallback_dir| is the directory relative to $HOME that we 21 // a directory path. |fallback_dir| is the directory relative to $HOME that we
22 // use if |env_name| cannot be found or is empty. |fallback_dir| may be NULL. 22 // use if |env_name| cannot be found or is empty. |fallback_dir| may be NULL.
23 // Examples of |env_name| are XDG_CONFIG_HOME and XDG_DATA_HOME. 23 // Examples of |env_name| are XDG_CONFIG_HOME and XDG_DATA_HOME.
24 FilePath GetXDGDirectory(EnvVarGetter* env, const char* env_name, 24 FilePath GetXDGDirectory(Environment* env, const char* env_name,
25 const char* fallback_dir); 25 const char* fallback_dir);
26 26
27 // Wrapper around xdg_user_dir_lookup() from src/base/third_party/xdg-user-dirs 27 // Wrapper around xdg_user_dir_lookup() from src/base/third_party/xdg-user-dirs
28 // This looks up "well known" user directories like the desktop and music 28 // This looks up "well known" user directories like the desktop and music
29 // folder. Examples of |dir_name| are DESKTOP and MUSIC. 29 // folder. Examples of |dir_name| are DESKTOP and MUSIC.
30 FilePath GetXDGUserDirectory(EnvVarGetter* env, const char* dir_name, 30 FilePath GetXDGUserDirectory(Environment* env, const char* dir_name,
31 const char* fallback_dir); 31 const char* fallback_dir);
32 32
33 enum DesktopEnvironment { 33 enum DesktopEnvironment {
34 DESKTOP_ENVIRONMENT_OTHER, 34 DESKTOP_ENVIRONMENT_OTHER,
35 DESKTOP_ENVIRONMENT_GNOME, 35 DESKTOP_ENVIRONMENT_GNOME,
36 // KDE3 and KDE4 are sufficiently different that we count 36 // KDE3 and KDE4 are sufficiently different that we count
37 // them as two different desktop environments here. 37 // them as two different desktop environments here.
38 DESKTOP_ENVIRONMENT_KDE3, 38 DESKTOP_ENVIRONMENT_KDE3,
39 DESKTOP_ENVIRONMENT_KDE4, 39 DESKTOP_ENVIRONMENT_KDE4,
40 DESKTOP_ENVIRONMENT_XFCE, 40 DESKTOP_ENVIRONMENT_XFCE,
41 }; 41 };
42 42
43 // Return an entry from the DesktopEnvironment enum with a best guess 43 // Return an entry from the DesktopEnvironment enum with a best guess
44 // of which desktop environment we're using. We use this to know when 44 // of which desktop environment we're using. We use this to know when
45 // to attempt to use preferences from the desktop environment -- 45 // to attempt to use preferences from the desktop environment --
46 // proxy settings, password manager, etc. 46 // proxy settings, password manager, etc.
47 DesktopEnvironment GetDesktopEnvironment(EnvVarGetter* env); 47 DesktopEnvironment GetDesktopEnvironment(Environment* env);
48 48
49 // Return a string representation of the given desktop environment. 49 // Return a string representation of the given desktop environment.
50 // May return NULL in the case of DESKTOP_ENVIRONMENT_OTHER. 50 // May return NULL in the case of DESKTOP_ENVIRONMENT_OTHER.
51 const char* GetDesktopEnvironmentName(DesktopEnvironment env); 51 const char* GetDesktopEnvironmentName(DesktopEnvironment env);
52 // Convenience wrapper that calls GetDesktopEnvironment() first. 52 // Convenience wrapper that calls GetDesktopEnvironment() first.
53 const char* GetDesktopEnvironmentName(EnvVarGetter* env); 53 const char* GetDesktopEnvironmentName(Environment* env);
54 54
55 } // namespace base 55 } // namespace base
56 56
57 #endif // BASE_XDG_UTIL_H_ 57 #endif // BASE_XDG_UTIL_H_
OLDNEW
« base/environment.h ('K') | « base/nss_util.cc ('k') | base/xdg_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698