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

Side by Side Diff: base/nix/xdg_util.h

Issue 6904109: linux: components support for base/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 9 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « base/message_pump_libevent.h ('k') | base/process_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_NIX_XDG_UTIL_H_ 5 #ifndef BASE_NIX_XDG_UTIL_H_
6 #define BASE_NIX_XDG_UTIL_H_ 6 #define BASE_NIX_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 environments. 10 // This file contains utilities found across free desktop environments.
11 // 11 //
12 // TODO(brettw) this file should be in app/x11, but is currently used by 12 // TODO(brettw) this file should be in app/x11, but is currently used by
13 // net. We should have a net API to allow the embedder to specify the behavior 13 // net. We should have a net API to allow the embedder to specify the behavior
14 // that it uses XDG for, and then move this file. 14 // that it uses XDG for, and then move this file.
15 15
16 #include "base/base_api.h"
17
16 #ifdef nix 18 #ifdef nix
17 #error asdf 19 #error asdf
18 #endif 20 #endif
19 21
20 class FilePath; 22 class FilePath;
21 23
22 namespace base { 24 namespace base {
23 25
24 class Environment; 26 class Environment;
25 27
26 namespace nix { 28 namespace nix {
27 29
28 // Utility function for getting XDG directories. 30 // Utility function for getting XDG directories.
29 // |env_name| is the name of an environment variable that we want to use to get 31 // |env_name| is the name of an environment variable that we want to use to get
30 // a directory path. |fallback_dir| is the directory relative to $HOME that we 32 // a directory path. |fallback_dir| is the directory relative to $HOME that we
31 // use if |env_name| cannot be found or is empty. |fallback_dir| may be NULL. 33 // use if |env_name| cannot be found or is empty. |fallback_dir| may be NULL.
32 // Examples of |env_name| are XDG_CONFIG_HOME and XDG_DATA_HOME. 34 // Examples of |env_name| are XDG_CONFIG_HOME and XDG_DATA_HOME.
33 FilePath GetXDGDirectory(Environment* env, const char* env_name, 35 BASE_API FilePath GetXDGDirectory(Environment* env, const char* env_name,
34 const char* fallback_dir); 36 const char* fallback_dir);
35 37
36 // Wrapper around xdg_user_dir_lookup() from src/base/third_party/xdg-user-dirs 38 // Wrapper around xdg_user_dir_lookup() from src/base/third_party/xdg-user-dirs
37 // This looks up "well known" user directories like the desktop and music 39 // This looks up "well known" user directories like the desktop and music
38 // folder. Examples of |dir_name| are DESKTOP and MUSIC. 40 // folder. Examples of |dir_name| are DESKTOP and MUSIC.
39 FilePath GetXDGUserDirectory(Environment* env, const char* dir_name, 41 BASE_API FilePath GetXDGUserDirectory(Environment* env, const char* dir_name,
40 const char* fallback_dir); 42 const char* fallback_dir);
41 43
42 enum DesktopEnvironment { 44 enum DesktopEnvironment {
43 DESKTOP_ENVIRONMENT_OTHER, 45 DESKTOP_ENVIRONMENT_OTHER,
44 DESKTOP_ENVIRONMENT_GNOME, 46 DESKTOP_ENVIRONMENT_GNOME,
45 // KDE3 and KDE4 are sufficiently different that we count 47 // KDE3 and KDE4 are sufficiently different that we count
46 // them as two different desktop environments here. 48 // them as two different desktop environments here.
47 DESKTOP_ENVIRONMENT_KDE3, 49 DESKTOP_ENVIRONMENT_KDE3,
48 DESKTOP_ENVIRONMENT_KDE4, 50 DESKTOP_ENVIRONMENT_KDE4,
49 DESKTOP_ENVIRONMENT_XFCE, 51 DESKTOP_ENVIRONMENT_XFCE,
50 }; 52 };
51 53
52 // Return an entry from the DesktopEnvironment enum with a best guess 54 // Return an entry from the DesktopEnvironment enum with a best guess
53 // of which desktop environment we're using. We use this to know when 55 // of which desktop environment we're using. We use this to know when
54 // to attempt to use preferences from the desktop environment -- 56 // to attempt to use preferences from the desktop environment --
55 // proxy settings, password manager, etc. 57 // proxy settings, password manager, etc.
56 DesktopEnvironment GetDesktopEnvironment(Environment* env); 58 BASE_API DesktopEnvironment GetDesktopEnvironment(Environment* env);
57 59
58 // Return a string representation of the given desktop environment. 60 // Return a string representation of the given desktop environment.
59 // May return NULL in the case of DESKTOP_ENVIRONMENT_OTHER. 61 // May return NULL in the case of DESKTOP_ENVIRONMENT_OTHER.
60 const char* GetDesktopEnvironmentName(DesktopEnvironment env); 62 BASE_API const char* GetDesktopEnvironmentName(DesktopEnvironment env);
61 // Convenience wrapper that calls GetDesktopEnvironment() first. 63 // Convenience wrapper that calls GetDesktopEnvironment() first.
62 const char* GetDesktopEnvironmentName(Environment* env); 64 BASE_API const char* GetDesktopEnvironmentName(Environment* env);
63 65
64 } // namespace nix 66 } // namespace nix
65 } // namespace base 67 } // namespace base
66 68
67 #endif // BASE_NIX_XDG_UTIL_H_ 69 #endif // BASE_NIX_XDG_UTIL_H_
OLDNEW
« no previous file with comments | « base/message_pump_libevent.h ('k') | base/process_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698