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