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

Unified Diff: base/android/path_utils.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/android/path_utils.cc
diff --git a/base/android/path_utils.cc b/base/android/path_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b3065d57bf981294fc45ea1b5c6900681d58b639
--- /dev/null
+++ b/base/android/path_utils.cc
@@ -0,0 +1,39 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/android/path_utils.h"
+
+#include "base/android/auto_jobject.h"
+#include "base/android/jni_android.h"
+#include "base/android/jni_string.h"
+
+#include "jni/path_utils_jni.h"
+
+namespace base {
+namespace android {
+
+std::string GetDataDirectory() {
+ JNIEnv* env = AttachCurrentThread();
+ AutoJObject path = AutoJObject::FromLocalRef(
+ env, Java_PathUtils_getDataDirectory(
+ env, base::android::GetApplicationContext()));
M-A Ruel 2011/11/11 13:09:07 Why specify base::android:: when you are already i
+ return base::android::ConvertJavaStringToUTF8(
+ env, static_cast<jstring>(path.obj()));
+}
+
+std::string GetCacheDirectory() {
+ JNIEnv* env = AttachCurrentThread();
+ AutoJObject path = AutoJObject::FromLocalRef(
+ env, Java_PathUtils_getCacheDirectory(
+ env, base::android::GetApplicationContext()));
+ return base::android::ConvertJavaStringToUTF8(
+ env, static_cast<jstring>(path.obj()));
+}
+
+bool RegisterPathUtils(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+} // namespace android
+} // namespace base

Powered by Google App Engine
This is Rietveld 408576698