Add OWNERS to content/browser/quota
[chromium-blink-merge.git] / base / nix / xdg_util.h
bloba8b778405f2f80464512ffec6cbfd4d87ed276bc
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef BASE_NIX_XDG_UTIL_H_
6 #define BASE_NIX_XDG_UTIL_H_
8 // XDG refers to http://en.wikipedia.org/wiki/Freedesktop.org .
9 // This file contains utilities found across free desktop environments.
11 // TODO(brettw) this file should be in app/x11, but is currently used by
12 // net. We should have a net API to allow the embedder to specify the behavior
13 // that it uses XDG for, and then move this file.
15 #include "base/base_export.h"
17 #ifdef nix
18 #error asdf
19 #endif
21 namespace base {
23 class Environment;
24 class FilePath;
26 namespace nix {
28 // The default XDG config directory name.
29 BASE_EXPORT extern const char kDotConfigDir[];
31 // The XDG config directory environment variable.
32 BASE_EXPORT extern const char kXdgConfigHomeEnvVar[];
34 // Utility function for getting XDG directories.
35 // |env_name| is the name of an environment variable that we want to use to get
36 // a directory path. |fallback_dir| is the directory relative to $HOME that we
37 // use if |env_name| cannot be found or is empty. |fallback_dir| may be NULL.
38 // Examples of |env_name| are XDG_CONFIG_HOME and XDG_DATA_HOME.
39 BASE_EXPORT FilePath GetXDGDirectory(Environment* env, const char* env_name,
40 const char* fallback_dir);
42 // Wrapper around xdg_user_dir_lookup() from src/base/third_party/xdg-user-dirs
43 // This looks up "well known" user directories like the desktop and music
44 // folder. Examples of |dir_name| are DESKTOP and MUSIC.
45 BASE_EXPORT FilePath GetXDGUserDirectory(const char* dir_name,
46 const char* fallback_dir);
48 enum DesktopEnvironment {
49 DESKTOP_ENVIRONMENT_OTHER,
50 DESKTOP_ENVIRONMENT_GNOME,
51 // KDE3 and KDE4 are sufficiently different that we count
52 // them as two different desktop environments here.
53 DESKTOP_ENVIRONMENT_KDE3,
54 DESKTOP_ENVIRONMENT_KDE4,
55 DESKTOP_ENVIRONMENT_UNITY,
56 DESKTOP_ENVIRONMENT_XFCE,
59 // Return an entry from the DesktopEnvironment enum with a best guess
60 // of which desktop environment we're using. We use this to know when
61 // to attempt to use preferences from the desktop environment --
62 // proxy settings, password manager, etc.
63 BASE_EXPORT DesktopEnvironment GetDesktopEnvironment(Environment* env);
65 // Return a string representation of the given desktop environment.
66 // May return NULL in the case of DESKTOP_ENVIRONMENT_OTHER.
67 BASE_EXPORT const char* GetDesktopEnvironmentName(DesktopEnvironment env);
68 // Convenience wrapper that calls GetDesktopEnvironment() first.
69 BASE_EXPORT const char* GetDesktopEnvironmentName(Environment* env);
71 } // namespace nix
72 } // namespace base
74 #endif // BASE_NIX_XDG_UTIL_H_