Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / common / chrome_paths_android.cc
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
5 #include "chrome/common/chrome_paths_internal.h"
6
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"
11
12 namespace chrome {
13
14 void GetUserCacheDirectory(const base::FilePath& profile_dir,
15                            base::FilePath* result) {
16   if (!PathService::Get(base::DIR_CACHE, result))
17     *result = profile_dir;
18 }
19
20 bool GetDefaultUserDataDirectory(base::FilePath* result) {
21   return PathService::Get(base::DIR_ANDROID_APP_DATA, result);
22 }
23
24 bool GetUserDocumentsDirectory(base::FilePath* result) {
25   if (!GetDefaultUserDataDirectory(result))
26     return false;
27   *result = result->Append("Documents");
28   return true;
29 }
30
31 bool GetUserDownloadsDirectory(base::FilePath* result) {
32   if (!GetDefaultUserDataDirectory(result))
33     return false;
34   *result = result->Append("Downloads");
35   return true;
36 }
37
38 bool GetUserMusicDirectory(base::FilePath* result) {
39   NOTIMPLEMENTED();
40   return false;
41 }
42
43 bool GetUserPicturesDirectory(base::FilePath* result) {
44   NOTIMPLEMENTED();
45   return false;
46 }
47
48 bool GetUserVideosDirectory(base::FilePath* result) {
49   NOTIMPLEMENTED();
50   return false;
51 }
52
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();
57 }
58
59 }  // namespace chrome