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 #include "base/base_paths.h" | |
6 | |
7 #include <unistd.h> | 5 #include <unistd.h> |
8 | 6 |
9 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
10 #include "base/android/path_utils.h" | 8 #include "base/android/path_utils.h" |
| 9 #include "base/base_paths.h" |
| 10 #include "base/base_paths_android.h" |
| 11 #include "base/base_paths_posix.h" |
11 #include "base/file_path.h" | 12 #include "base/file_path.h" |
12 #include "base/file_util.h" | 13 #include "base/file_util.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 const char kSelfExe[] = "/proc/self/exe"; | 18 const char kSelfExe[] = "/proc/self/exe"; |
18 | 19 |
19 } // namespace | 20 } // namespace |
20 | 21 |
(...skipping 19 matching lines...) Expand all Loading... |
40 } | 41 } |
41 case base::DIR_MODULE: { | 42 case base::DIR_MODULE: { |
42 *result = FilePath(base::android::GetNativeLibraryDirectory()); | 43 *result = FilePath(base::android::GetNativeLibraryDirectory()); |
43 return true; | 44 return true; |
44 } | 45 } |
45 case base::DIR_SOURCE_ROOT: { | 46 case base::DIR_SOURCE_ROOT: { |
46 // This const is only used for tests. | 47 // This const is only used for tests. |
47 *result = FilePath(base::android::GetExternalStorageDirectory()); | 48 *result = FilePath(base::android::GetExternalStorageDirectory()); |
48 return true; | 49 return true; |
49 } | 50 } |
| 51 case base::DIR_USER_DESKTOP: { |
| 52 // Android doesn't support GetUserDesktop. |
| 53 NOTIMPLEMENTED(); |
| 54 return false; |
| 55 } |
50 case base::DIR_CACHE: { | 56 case base::DIR_CACHE: { |
51 *result = FilePath(base::android::GetCacheDirectory()); | 57 *result = FilePath(base::android::GetCacheDirectory()); |
52 return true; | 58 return true; |
53 } | 59 } |
54 case base::DIR_ANDROID_APP_DATA: { | 60 case base::DIR_ANDROID_APP_DATA: { |
55 *result = FilePath(base::android::GetDataDirectory()); | 61 *result = FilePath(base::android::GetDataDirectory()); |
56 return true; | 62 return true; |
57 } | 63 } |
58 case base::DIR_HOME: { | 64 case base::DIR_HOME: { |
59 *result = file_util::GetHomeDir(); | 65 *result = file_util::GetHomeDir(); |
60 return true; | 66 return true; |
61 } | 67 } |
62 case base::DIR_ANDROID_EXTERNAL_STORAGE: { | 68 case base::DIR_ANDROID_EXTERNAL_STORAGE: { |
63 *result = FilePath(base::android::GetExternalStorageDirectory()); | 69 *result = FilePath(base::android::GetExternalStorageDirectory()); |
64 return true; | 70 return true; |
65 } | 71 } |
66 default: { | 72 default: { |
67 // Note: the path system expects this function to override the default | 73 // Note: the path system expects this function to override the default |
68 // behavior. So no need to log an error if we don't support a given | 74 // behavior. So no need to log an error if we don't support a given |
69 // path. The system will just use the default. | 75 // path. The system will just use the default. |
70 return false; | 76 return false; |
71 } | 77 } |
72 } | 78 } |
73 } | 79 } |
74 | 80 |
75 } // namespace base | 81 } // namespace base |
OLD | NEW |