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

Side by Side Diff: base/android/path_utils.cc

Issue 7491099: Update base/android to use new ScopedJava(Global)Reference (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Also fix license headers Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/android/jni_array.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/android/path_utils.h" 5 #include "base/android/path_utils.h"
6 6
7 #include "base/android/auto_jobject.h"
8 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
9 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/android/scoped_java_reference.h"
10 10
11 #include "jni/path_utils_jni.h" 11 #include "jni/path_utils_jni.h"
12 12
13 namespace base { 13 namespace base {
14 namespace android { 14 namespace android {
15 15
16 std::string GetDataDirectory() { 16 std::string GetDataDirectory() {
17 JNIEnv* env = AttachCurrentThread(); 17 JNIEnv* env = AttachCurrentThread();
18 AutoJObject path = AutoJObject::FromLocalRef( 18 ScopedJavaReference<jstring> path(env, Java_PathUtils_getDataDirectory(
19 env, Java_PathUtils_getDataDirectory( 19 env, base::android::GetApplicationContext()));
20 env, base::android::GetApplicationContext())); 20 return base::android::ConvertJavaStringToUTF8(env, path.obj());
21 return base::android::ConvertJavaStringToUTF8(
22 env, static_cast<jstring>(path.obj()));
23 } 21 }
24 22
25 std::string GetCacheDirectory() { 23 std::string GetCacheDirectory() {
26 JNIEnv* env = AttachCurrentThread(); 24 JNIEnv* env = AttachCurrentThread();
27 AutoJObject path = AutoJObject::FromLocalRef( 25 ScopedJavaReference<jstring> path(env, Java_PathUtils_getCacheDirectory(
28 env, Java_PathUtils_getCacheDirectory( 26 env, base::android::GetApplicationContext()));
29 env, base::android::GetApplicationContext())); 27 return base::android::ConvertJavaStringToUTF8(env, path.obj());
30 return base::android::ConvertJavaStringToUTF8(
31 env, static_cast<jstring>(path.obj()));
32 } 28 }
33 29
34 bool RegisterPathUtils(JNIEnv* env) { 30 bool RegisterPathUtils(JNIEnv* env) {
35 return RegisterNativesImpl(env); 31 return RegisterNativesImpl(env);
36 } 32 }
37 33
38 } // namespace android 34 } // namespace android
39 } // namespace base 35 } // namespace base
OLDNEW
« no previous file with comments | « base/android/jni_array.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698