| 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 // Defines base::PathProviderAndroid which replaces base::PathProviderPosix for | 5 // Defines base::PathProviderAndroid which replaces base::PathProviderPosix for |
| 6 // Android in base/path_service.cc. | 6 // Android in base/path_service.cc. |
| 7 | 7 |
| 8 #include <unistd.h> | 8 #include <unistd.h> |
| 9 | 9 |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } | 28 } |
| 29 bin_dir[bin_dir_size] = 0; | 29 bin_dir[bin_dir_size] = 0; |
| 30 *result = FilePath(bin_dir); | 30 *result = FilePath(bin_dir); |
| 31 return true; | 31 return true; |
| 32 } | 32 } |
| 33 case base::FILE_MODULE: | 33 case base::FILE_MODULE: |
| 34 // dladdr didn't work in Android as only the file name was returned. | 34 // dladdr didn't work in Android as only the file name was returned. |
| 35 NOTIMPLEMENTED(); | 35 NOTIMPLEMENTED(); |
| 36 return false; | 36 return false; |
| 37 case base::DIR_MODULE: | 37 case base::DIR_MODULE: |
| 38 *result = FilePath(base::android::GetNativeLibraryDirectory()); | 38 return base::android::GetNativeLibraryDirectory(result); |
| 39 return true; | |
| 40 case base::DIR_SOURCE_ROOT: | 39 case base::DIR_SOURCE_ROOT: |
| 41 // This const is only used for tests. | 40 // This const is only used for tests. |
| 42 *result = FilePath(base::android::GetExternalStorageDirectory()); | 41 return base::android::GetExternalStorageDirectory(result); |
| 43 return true; | |
| 44 case base::DIR_USER_DESKTOP: | 42 case base::DIR_USER_DESKTOP: |
| 45 // Android doesn't support GetUserDesktop. | 43 // Android doesn't support GetUserDesktop. |
| 46 NOTIMPLEMENTED(); | 44 NOTIMPLEMENTED(); |
| 47 return false; | 45 return false; |
| 48 case base::DIR_CACHE: | 46 case base::DIR_CACHE: |
| 49 *result = FilePath(base::android::GetCacheDirectory()); | 47 return base::android::GetCacheDirectory(result); |
| 50 return true; | |
| 51 case base::DIR_ANDROID_APP_DATA: | 48 case base::DIR_ANDROID_APP_DATA: |
| 52 *result = FilePath(base::android::GetDataDirectory()); | 49 return base::android::GetDataDirectory(result); |
| 53 return true; | |
| 54 case base::DIR_HOME: | 50 case base::DIR_HOME: |
| 55 *result = file_util::GetHomeDir(); | 51 *result = file_util::GetHomeDir(); |
| 56 return true; | 52 return true; |
| 57 case base::DIR_ANDROID_EXTERNAL_STORAGE: | 53 case base::DIR_ANDROID_EXTERNAL_STORAGE: |
| 58 *result = FilePath(base::android::GetExternalStorageDirectory()); | 54 return base::android::GetExternalStorageDirectory(result); |
| 59 return true; | |
| 60 default: | 55 default: |
| 61 // Note: the path system expects this function to override the default | 56 // Note: the path system expects this function to override the default |
| 62 // behavior. So no need to log an error if we don't support a given | 57 // behavior. So no need to log an error if we don't support a given |
| 63 // path. The system will just use the default. | 58 // path. The system will just use the default. |
| 64 return false; | 59 return false; |
| 65 } | 60 } |
| 66 } | 61 } |
| 67 | 62 |
| 68 } // namespace base | 63 } // namespace base |
| OLD | NEW |