chrome_paths_internal.h 4.4 KB

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