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/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 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 bool GetCacheDirectory(FilePath* result) { | 35 bool GetCacheDirectory(FilePath* result) { |
36 JNIEnv* env = AttachCurrentThread(); | 36 JNIEnv* env = AttachCurrentThread(); |
37 ScopedJavaLocalRef<jstring> path = | 37 ScopedJavaLocalRef<jstring> path = |
38 Java_PathUtils_getCacheDirectory(env, GetApplicationContext()); | 38 Java_PathUtils_getCacheDirectory(env, GetApplicationContext()); |
39 FilePath cache_path(ConvertJavaStringToUTF8(path)); | 39 FilePath cache_path(ConvertJavaStringToUTF8(path)); |
40 *result = cache_path; | 40 *result = cache_path; |
41 return true; | 41 return true; |
42 } | 42 } |
43 | 43 |
| 44 bool GetThumbnailCacheDirectory(FilePath* result) { |
| 45 JNIEnv* env = AttachCurrentThread(); |
| 46 ScopedJavaLocalRef<jstring> path = |
| 47 Java_PathUtils_getThumbnailCacheDirectoryPath(env, |
| 48 GetApplicationContext()); |
| 49 FilePath thumbnail_cache_path(ConvertJavaStringToUTF8(path)); |
| 50 *result = thumbnail_cache_path; |
| 51 return true; |
| 52 } |
| 53 |
44 bool GetDownloadsDirectory(FilePath* result) { | 54 bool GetDownloadsDirectory(FilePath* result) { |
45 JNIEnv* env = AttachCurrentThread(); | 55 JNIEnv* env = AttachCurrentThread(); |
46 ScopedJavaLocalRef<jstring> path = | 56 ScopedJavaLocalRef<jstring> path = |
47 Java_PathUtils_getDownloadsDirectory(env, GetApplicationContext()); | 57 Java_PathUtils_getDownloadsDirectory(env, GetApplicationContext()); |
48 FilePath downloads_path(ConvertJavaStringToUTF8(path)); | 58 FilePath downloads_path(ConvertJavaStringToUTF8(path)); |
49 *result = downloads_path; | 59 *result = downloads_path; |
50 return true; | 60 return true; |
51 } | 61 } |
52 | 62 |
53 bool GetNativeLibraryDirectory(FilePath* result) { | 63 bool GetNativeLibraryDirectory(FilePath* result) { |
(...skipping 13 matching lines...) Expand all Loading... |
67 *result = storage_path; | 77 *result = storage_path; |
68 return true; | 78 return true; |
69 } | 79 } |
70 | 80 |
71 bool RegisterPathUtils(JNIEnv* env) { | 81 bool RegisterPathUtils(JNIEnv* env) { |
72 return RegisterNativesImpl(env); | 82 return RegisterNativesImpl(env); |
73 } | 83 } |
74 | 84 |
75 } // namespace android | 85 } // namespace android |
76 } // namespace base | 86 } // namespace base |
OLD | NEW |