Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Unified Diff: base/base_paths_android.cc

Issue 7518032: Android's paths and message loop implementation with JNI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix dependence again. Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/base_paths_android.cc
diff --git a/base/base_paths_android.cc b/base/base_paths_android.cc
index 5a03cc0abca381481e237c67d20bbfb9987e1dfe..9d04b764df03b667481518c0b83e2e3bb542b8df 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

Powered by Google App Engine
This is Rietveld 408576698