Roll src/third_party/WebKit f298044:aa8346d (svn 202628:202629)
[chromium-blink-merge.git] / chrome / common / chrome_paths_internal.h
blobae1cd623d773a011c97ef5dc7f6271fdf844e3a3
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 CHROME_COMMON_CHROME_PATHS_INTERNAL_H_
6 #define CHROME_COMMON_CHROME_PATHS_INTERNAL_H_
8 #include <string>
10 #include "build/build_config.h"
12 #if defined(OS_MACOSX)
13 #if defined(__OBJC__)
14 @class NSBundle;
15 #else
16 class NSBundle;
17 #endif
18 #endif
20 namespace base {
21 class FilePath;
24 namespace chrome {
26 // Get the path to the user's data directory, regardless of whether
27 // DIR_USER_DATA has been overridden by a command-line option.
28 bool GetDefaultUserDataDirectory(base::FilePath* result);
30 // Get the path to the user's cache directory. This is normally the
31 // same as the profile directory, but on Linux it can also be
32 // $XDG_CACHE_HOME and on Mac it can be under ~/Library/Caches.
33 // Note that the Chrome cache directories are actually subdirectories
34 // of this directory, with names like "Cache" and "Media Cache".
35 // This will always fill in |result| with a directory, sometimes
36 // just |profile_dir|.
37 void GetUserCacheDirectory(const base::FilePath& profile_dir, base::FilePath* result);
39 // Get the path to the user's documents directory.
40 bool GetUserDocumentsDirectory(base::FilePath* result);
42 #if defined(OS_WIN) || defined(OS_LINUX)
43 // Gets the path to a safe default download directory for a user.
44 bool GetUserDownloadsDirectorySafe(base::FilePath* result);
45 #endif
47 // Get the path to the user's downloads directory.
48 bool GetUserDownloadsDirectory(base::FilePath* result);
50 // Gets the path to the user's music directory.
51 bool GetUserMusicDirectory(base::FilePath* result);
53 // Gets the path to the user's pictures directory.
54 bool GetUserPicturesDirectory(base::FilePath* result);
56 // Gets the path to the user's videos directory.
57 bool GetUserVideosDirectory(base::FilePath* result);
59 #if defined(OS_MACOSX) && !defined(OS_IOS)
60 // The "versioned directory" is a directory in the browser .app bundle. It
61 // contains the bulk of the application, except for the things that the system
62 // requires be located at spepcific locations. The versioned directory is
63 // in the .app at Contents/Versions/w.x.y.z.
64 base::FilePath GetVersionedDirectory();
66 // This overrides the directory returned by |GetVersionedDirectory()|, to be
67 // used when |GetVersionedDirectory()| can't automatically determine the proper
68 // location. This is the case when the browser didn't load itself but by, e.g.,
69 // the app mode loader. This should be called before |ChromeMain()|. This takes
70 // ownership of the object |path| and the caller must not delete it.
71 void SetOverrideVersionedDirectory(const base::FilePath* path);
73 // Most of the application is further contained within the framework. The
74 // framework bundle is located within the versioned directory at a specific
75 // path. The only components in the versioned directory not included in the
76 // framework are things that also depend on the framework, such as the helper
77 // app bundle.
78 base::FilePath GetFrameworkBundlePath();
80 // Get the local library directory.
81 bool GetLocalLibraryDirectory(base::FilePath* result);
83 // Get the user library directory.
84 bool GetUserLibraryDirectory(base::FilePath* result);
86 // Get the user applications directory.
87 bool GetUserApplicationsDirectory(base::FilePath* result);
89 // Get the global Application Support directory (under /Library/).
90 bool GetGlobalApplicationSupportDirectory(base::FilePath* result);
92 // Returns the NSBundle for the outer browser application, even when running
93 // inside the helper. In unbundled applications, such as tests, returns nil.
94 NSBundle* OuterAppBundle();
96 // Get the user data directory for the Chrome browser bundle at |bundle|.
97 // |bundle| should be the same value that would be returned from +[NSBundle
98 // mainBundle] if Chrome were launched normaly. This is used by app shims,
99 // which run from a bundle which isn't Chrome itself, but which need access to
100 // the user data directory to connect to a UNIX-domain socket therein.
101 // Returns false if there was a problem fetching the app data directory.
102 bool GetUserDataDirectoryForBrowserBundle(NSBundle* bundle,
103 base::FilePath* result);
105 #endif // OS_MACOSX && !OS_IOS
107 // Checks if the |process_type| has the rights to access the profile.
108 bool ProcessNeedsProfileDir(const std::string& process_type);
110 } // namespace chrome
112 #endif // CHROME_COMMON_CHROME_PATHS_INTERNAL_H_