OLD | NEW |
1 // Copyright (c) 2012 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/context_utils.h" | 7 #include "base/android/context_utils.h" |
8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 bool GetThumbnailCacheDirectory(FilePath* result) { | 42 bool GetThumbnailCacheDirectory(FilePath* result) { |
43 JNIEnv* env = AttachCurrentThread(); | 43 JNIEnv* env = AttachCurrentThread(); |
44 ScopedJavaLocalRef<jstring> path = | 44 ScopedJavaLocalRef<jstring> path = |
45 Java_PathUtils_getThumbnailCacheDirectory(env); | 45 Java_PathUtils_getThumbnailCacheDirectory(env); |
46 FilePath thumbnail_cache_path(ConvertJavaStringToUTF8(path)); | 46 FilePath thumbnail_cache_path(ConvertJavaStringToUTF8(path)); |
47 *result = thumbnail_cache_path; | 47 *result = thumbnail_cache_path; |
48 return true; | 48 return true; |
49 } | 49 } |
50 | 50 |
| 51 bool GetDownloadInternalDirectory(FilePath* result) { |
| 52 JNIEnv* env = AttachCurrentThread(); |
| 53 ScopedJavaLocalRef<jstring> path = |
| 54 Java_PathUtils_getDownloadInternalDirectory(env); |
| 55 FilePath download_internal_path(ConvertJavaStringToUTF8(path)); |
| 56 *result = download_internal_path; |
| 57 return true; |
| 58 } |
| 59 |
51 bool GetDownloadsDirectory(FilePath* result) { | 60 bool GetDownloadsDirectory(FilePath* result) { |
52 JNIEnv* env = AttachCurrentThread(); | 61 JNIEnv* env = AttachCurrentThread(); |
53 ScopedJavaLocalRef<jstring> path = Java_PathUtils_getDownloadsDirectory(env); | 62 ScopedJavaLocalRef<jstring> path = Java_PathUtils_getDownloadsDirectory(env); |
54 FilePath downloads_path(ConvertJavaStringToUTF8(path)); | 63 FilePath downloads_path(ConvertJavaStringToUTF8(path)); |
55 *result = downloads_path; | 64 *result = downloads_path; |
56 return true; | 65 return true; |
57 } | 66 } |
58 | 67 |
59 bool GetNativeLibraryDirectory(FilePath* result) { | 68 bool GetNativeLibraryDirectory(FilePath* result) { |
60 JNIEnv* env = AttachCurrentThread(); | 69 JNIEnv* env = AttachCurrentThread(); |
61 ScopedJavaLocalRef<jstring> path = | 70 ScopedJavaLocalRef<jstring> path = |
62 Java_PathUtils_getNativeLibraryDirectory(env); | 71 Java_PathUtils_getNativeLibraryDirectory(env); |
63 FilePath library_path(ConvertJavaStringToUTF8(path)); | 72 FilePath library_path(ConvertJavaStringToUTF8(path)); |
64 *result = library_path; | 73 *result = library_path; |
65 return true; | 74 return true; |
66 } | 75 } |
67 | 76 |
68 bool GetExternalStorageDirectory(FilePath* result) { | 77 bool GetExternalStorageDirectory(FilePath* result) { |
69 JNIEnv* env = AttachCurrentThread(); | 78 JNIEnv* env = AttachCurrentThread(); |
70 ScopedJavaLocalRef<jstring> path = | 79 ScopedJavaLocalRef<jstring> path = |
71 Java_PathUtils_getExternalStorageDirectory(env); | 80 Java_PathUtils_getExternalStorageDirectory(env); |
72 FilePath storage_path(ConvertJavaStringToUTF8(path)); | 81 FilePath storage_path(ConvertJavaStringToUTF8(path)); |
73 *result = storage_path; | 82 *result = storage_path; |
74 return true; | 83 return true; |
75 } | 84 } |
76 | 85 |
77 } // namespace android | 86 } // namespace android |
78 } // namespace base | 87 } // namespace base |
OLD | NEW |