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

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

Issue 9443018: Upstream Android's PathUtils implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased patch Created 8 years, 9 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
OLDNEW
1 // Copyright (c) 2011 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 #include "base/android/path_utils.h" 5 #include "base/android/path_utils.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.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 ScopedJavaLocalRef<jstring> path(env, Java_PathUtils_getDataDirectory( 18 ScopedJavaLocalRef<jstring> path =
19 env, base::android::GetApplicationContext())); 19 Java_PathUtils_getDataDirectory(env, GetApplicationContext());
20 return base::android::ConvertJavaStringToUTF8(env, path.obj()); 20 return ConvertJavaStringToUTF8(path);
21 } 21 }
22 22
23 std::string GetCacheDirectory() { 23 std::string GetCacheDirectory() {
24 JNIEnv* env = AttachCurrentThread(); 24 JNIEnv* env = AttachCurrentThread();
25 ScopedJavaLocalRef<jstring> path(env, Java_PathUtils_getCacheDirectory( 25 ScopedJavaLocalRef<jstring> path =
26 env, base::android::GetApplicationContext())); 26 Java_PathUtils_getCacheDirectory(env, GetApplicationContext());
27 return base::android::ConvertJavaStringToUTF8(env, path.obj()); 27 return ConvertJavaStringToUTF8(path);
28 }
29
30 std::string GetDownloadsDirectory() {
31 JNIEnv* env = AttachCurrentThread();
32 ScopedJavaLocalRef<jstring> path =
33 Java_PathUtils_getDownloadsDirectory(env, GetApplicationContext());
34 return ConvertJavaStringToUTF8(path);
28 } 35 }
29 36
30 bool RegisterPathUtils(JNIEnv* env) { 37 bool RegisterPathUtils(JNIEnv* env) {
31 return RegisterNativesImpl(env); 38 return RegisterNativesImpl(env);
32 } 39 }
33 40
34 } // namespace android 41 } // namespace android
35 } // namespace base 42 } // namespace base
OLDNEW
« no previous file with comments | « base/android/java/org/chromium/base/PathUtils.java ('k') | base/base.gyp » ('j') | base/base.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698