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 #include "chrome/common/chrome_paths_internal.h"
7 #include "base/files/file_path.h"
8 #include "base/logging.h"
9 #include "base/path_service.h"
10 #include "content/public/common/content_switches.h"
14 void GetUserCacheDirectory(const base::FilePath& profile_dir,
15 base::FilePath* result) {
16 if (!PathService::Get(base::DIR_CACHE, result))
17 *result = profile_dir;
20 bool GetDefaultUserDataDirectory(base::FilePath* result) {
21 return PathService::Get(base::DIR_ANDROID_APP_DATA, result);
24 bool GetUserDocumentsDirectory(base::FilePath* result) {
25 if (!GetDefaultUserDataDirectory(result))
27 *result = result->Append("Documents");
31 bool GetUserDownloadsDirectory(base::FilePath* result) {
32 if (!GetDefaultUserDataDirectory(result))
34 *result = result->Append("Downloads");
38 bool GetUserMusicDirectory(base::FilePath* result) {
43 bool GetUserPicturesDirectory(base::FilePath* result) {
48 bool GetUserVideosDirectory(base::FilePath* result) {
53 bool ProcessNeedsProfileDir(const std::string& process_type) {
54 // SELinux prohibits accessing the data directory from isolated services. Only
55 // the browser (empty process type) should access the profile directory.
56 return process_type.empty();