diff options
author | michaelbai@google.com <michaelbai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-02 16:11:16 +0000 |
---|---|---|
committer | michaelbai@google.com <michaelbai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-02 16:11:16 +0000 |
commit | 61c86c6a23ab32e81337f66f1b958d8ec3e8bd45 (patch) | |
tree | 64f18cd34be5ad9ec1140c3e334f5483af8af462 /base/base_paths_android.cc | |
parent | eccefee0229e222c0130dca22412b4dccfa3f181 (diff) | |
download | chromium_src-61c86c6a23ab32e81337f66f1b958d8ec3e8bd45.zip chromium_src-61c86c6a23ab32e81337f66f1b958d8ec3e8bd45.tar.gz chromium_src-61c86c6a23ab32e81337f66f1b958d8ec3e8bd45.tar.bz2 |
Android's paths and message loop implementation with JNI
BUG=
TEST=
Review URL: http://codereview.chromium.org/7518032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95085 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/base_paths_android.cc')
-rw-r--r-- | base/base_paths_android.cc | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/base/base_paths_android.cc b/base/base_paths_android.cc index 5a03cc0..9d04b76 100644 --- a/base/base_paths_android.cc +++ b/base/base_paths_android.cc @@ -6,13 +6,19 @@ #include <unistd.h> +#include "base/android/jni_android.h" +#include "base/android/path_utils.h" +#include "base/file_path.h" #include "base/logging.h" -#include "base/android_os.h" -namespace base { +namespace { const char kSelfExe[] = "/proc/self/exe"; +} // namespace + +namespace base { + bool PathProviderAndroid(int key, FilePath* result) { switch (key) { case base::FILE_EXE: { @@ -27,14 +33,12 @@ bool PathProviderAndroid(int key, FilePath* result) { return true; } case base::FILE_MODULE: - // TODO(port): Find out whether we can use dladdr to implement this, and - // then use DIR_MODULE's default implementation in base_file.cc. + // dladdr didn't work in Android as only the file name was returned. NOTIMPLEMENTED(); return false; case base::DIR_MODULE: { - AndroidOS* aos = AndroidOS::GetSharedInstance(); - DCHECK(aos); - *result = aos->GetLibDirectory(); + *result = FilePath(base::android::GetDataDirectory()).DirName() + .Append("lib"); return true; } case base::DIR_SOURCE_ROOT: @@ -42,12 +46,12 @@ bool PathProviderAndroid(int key, FilePath* result) { // to the device via test script. *result = FilePath(FILE_PATH_LITERAL("/data/local/tmp/")); return true; - case base::DIR_CACHE: { - AndroidOS* aos = AndroidOS::GetSharedInstance(); - DCHECK(aos); - *result = aos->GetCacheDirectory(); + case base::DIR_CACHE: + *result = FilePath(base::android::GetCacheDirectory()); + return true; + case base::DIR_ANDROID_APP_DATA: + *result = FilePath(base::android::GetDataDirectory()); return true; - } default: // Note: the path system expects this function to override the default // behavior. So no need to log an error if we don't support a given |