| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_COMMON_CHROME_PATHS_INTERNAL_H_ | 5 #ifndef CHROME_COMMON_CHROME_PATHS_INTERNAL_H_ |
| 6 #define CHROME_COMMON_CHROME_PATHS_INTERNAL_H_ | 6 #define CHROME_COMMON_CHROME_PATHS_INTERNAL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 | 11 |
| 12 #if defined(OS_MACOSX) | 12 #if defined(OS_MACOSX) |
| 13 #if defined(__OBJC__) | 13 #if defined(__OBJC__) |
| 14 @class NSBundle; | 14 @class NSBundle; |
| 15 #else | 15 #else |
| 16 class NSBundle; | 16 class NSBundle; |
| 17 #endif | 17 #endif |
| 18 #endif | 18 #endif |
| 19 | 19 |
| 20 namespace base { |
| 20 class FilePath; | 21 class FilePath; |
| 22 } |
| 21 | 23 |
| 22 namespace chrome { | 24 namespace chrome { |
| 23 | 25 |
| 24 // Get the path to the user's data directory, regardless of whether | 26 // Get the path to the user's data directory, regardless of whether |
| 25 // DIR_USER_DATA has been overridden by a command-line option. | 27 // DIR_USER_DATA has been overridden by a command-line option. |
| 26 bool GetDefaultUserDataDirectory(FilePath* result); | 28 bool GetDefaultUserDataDirectory(base::FilePath* result); |
| 27 | 29 |
| 28 // This returns the base directory in which Chrome Frame stores user profiles. | 30 // This returns the base directory in which Chrome Frame stores user profiles. |
| 29 // Note that this cannot be wrapped in a preprocessor define since | 31 // Note that this cannot be wrapped in a preprocessor define since |
| 30 // CF and Google Chrome want to share the same binaries. | 32 // CF and Google Chrome want to share the same binaries. |
| 31 bool GetChromeFrameUserDataDirectory(FilePath* result); | 33 bool GetChromeFrameUserDataDirectory(base::FilePath* result); |
| 32 | 34 |
| 33 // Get the path to the user's cache directory. This is normally the | 35 // Get the path to the user's cache directory. This is normally the |
| 34 // same as the profile directory, but on Linux it can also be | 36 // same as the profile directory, but on Linux it can also be |
| 35 // $XDG_CACHE_HOME and on Mac it can be under ~/Library/Caches. | 37 // $XDG_CACHE_HOME and on Mac it can be under ~/Library/Caches. |
| 36 // Note that the Chrome cache directories are actually subdirectories | 38 // Note that the Chrome cache directories are actually subdirectories |
| 37 // of this directory, with names like "Cache" and "Media Cache". | 39 // of this directory, with names like "Cache" and "Media Cache". |
| 38 // This will always fill in |result| with a directory, sometimes | 40 // This will always fill in |result| with a directory, sometimes |
| 39 // just |profile_dir|. | 41 // just |profile_dir|. |
| 40 void GetUserCacheDirectory(const FilePath& profile_dir, FilePath* result); | 42 void GetUserCacheDirectory(const base::FilePath& profile_dir, base::FilePath* re
sult); |
| 41 | 43 |
| 42 // Get the path to the user's documents directory. | 44 // Get the path to the user's documents directory. |
| 43 bool GetUserDocumentsDirectory(FilePath* result); | 45 bool GetUserDocumentsDirectory(base::FilePath* result); |
| 44 | 46 |
| 45 #if defined(OS_WIN) || defined(OS_LINUX) | 47 #if defined(OS_WIN) || defined(OS_LINUX) |
| 46 // Gets the path to a safe default download directory for a user. | 48 // Gets the path to a safe default download directory for a user. |
| 47 bool GetUserDownloadsDirectorySafe(FilePath* result); | 49 bool GetUserDownloadsDirectorySafe(base::FilePath* result); |
| 48 #endif | 50 #endif |
| 49 | 51 |
| 50 // Get the path to the user's downloads directory. | 52 // Get the path to the user's downloads directory. |
| 51 bool GetUserDownloadsDirectory(FilePath* result); | 53 bool GetUserDownloadsDirectory(base::FilePath* result); |
| 52 | 54 |
| 53 // Gets the path to the user's music directory. | 55 // Gets the path to the user's music directory. |
| 54 bool GetUserMusicDirectory(FilePath* result); | 56 bool GetUserMusicDirectory(base::FilePath* result); |
| 55 | 57 |
| 56 // Gets the path to the user's pictures directory. | 58 // Gets the path to the user's pictures directory. |
| 57 bool GetUserPicturesDirectory(FilePath* result); | 59 bool GetUserPicturesDirectory(base::FilePath* result); |
| 58 | 60 |
| 59 // Gets the path to the user's videos directory. | 61 // Gets the path to the user's videos directory. |
| 60 bool GetUserVideosDirectory(FilePath* result); | 62 bool GetUserVideosDirectory(base::FilePath* result); |
| 61 | 63 |
| 62 #if defined(OS_MACOSX) && !defined(OS_IOS) | 64 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 63 // The "versioned directory" is a directory in the browser .app bundle. It | 65 // The "versioned directory" is a directory in the browser .app bundle. It |
| 64 // contains the bulk of the application, except for the things that the system | 66 // contains the bulk of the application, except for the things that the system |
| 65 // requires be located at spepcific locations. The versioned directory is | 67 // requires be located at spepcific locations. The versioned directory is |
| 66 // in the .app at Contents/Versions/w.x.y.z. | 68 // in the .app at Contents/Versions/w.x.y.z. |
| 67 FilePath GetVersionedDirectory(); | 69 base::FilePath GetVersionedDirectory(); |
| 68 | 70 |
| 69 // This overrides the directory returned by |GetVersionedDirectory()|, to be | 71 // This overrides the directory returned by |GetVersionedDirectory()|, to be |
| 70 // used when |GetVersionedDirectory()| can't automatically determine the proper | 72 // used when |GetVersionedDirectory()| can't automatically determine the proper |
| 71 // location. This is the case when the browser didn't load itself but by, e.g., | 73 // location. This is the case when the browser didn't load itself but by, e.g., |
| 72 // the app mode loader. This should be called before |ChromeMain()|. This takes | 74 // the app mode loader. This should be called before |ChromeMain()|. This takes |
| 73 // ownership of the object |path| and the caller must not delete it. | 75 // ownership of the object |path| and the caller must not delete it. |
| 74 void SetOverrideVersionedDirectory(const FilePath* path); | 76 void SetOverrideVersionedDirectory(const base::FilePath* path); |
| 75 | 77 |
| 76 // Most of the application is further contained within the framework. The | 78 // Most of the application is further contained within the framework. The |
| 77 // framework bundle is located within the versioned directory at a specific | 79 // framework bundle is located within the versioned directory at a specific |
| 78 // path. The only components in the versioned directory not included in the | 80 // path. The only components in the versioned directory not included in the |
| 79 // framework are things that also depend on the framework, such as the helper | 81 // framework are things that also depend on the framework, such as the helper |
| 80 // app bundle. | 82 // app bundle. |
| 81 FilePath GetFrameworkBundlePath(); | 83 base::FilePath GetFrameworkBundlePath(); |
| 82 | 84 |
| 83 // Get the local library directory. | 85 // Get the local library directory. |
| 84 bool GetLocalLibraryDirectory(FilePath* result); | 86 bool GetLocalLibraryDirectory(base::FilePath* result); |
| 85 | 87 |
| 86 // Get the global Application Support directory (under /Library/). | 88 // Get the global Application Support directory (under /Library/). |
| 87 bool GetGlobalApplicationSupportDirectory(FilePath* result); | 89 bool GetGlobalApplicationSupportDirectory(base::FilePath* result); |
| 88 | 90 |
| 89 // Returns the NSBundle for the outer browser application, even when running | 91 // Returns the NSBundle for the outer browser application, even when running |
| 90 // inside the helper. In unbundled applications, such as tests, returns nil. | 92 // inside the helper. In unbundled applications, such as tests, returns nil. |
| 91 NSBundle* OuterAppBundle(); | 93 NSBundle* OuterAppBundle(); |
| 92 | 94 |
| 93 #endif // OS_MACOSX && !OS_IOS | 95 #endif // OS_MACOSX && !OS_IOS |
| 94 | 96 |
| 95 // Checks if the |process_type| has the rights to access the profile. | 97 // Checks if the |process_type| has the rights to access the profile. |
| 96 bool ProcessNeedsProfileDir(const std::string& process_type); | 98 bool ProcessNeedsProfileDir(const std::string& process_type); |
| 97 | 99 |
| 98 } // namespace chrome | 100 } // namespace chrome |
| 99 | 101 |
| 100 #endif // CHROME_COMMON_CHROME_PATHS_INTERNAL_H_ | 102 #endif // CHROME_COMMON_CHROME_PATHS_INTERNAL_H_ |
| OLD | NEW |