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 27 matching lines...) Expand all Loading... |
38 ScopedJavaLocalRef<jstring> path = | 38 ScopedJavaLocalRef<jstring> path = |
39 Java_PathUtils_getCacheDirectory(env, GetApplicationContext()); | 39 Java_PathUtils_getCacheDirectory(env, GetApplicationContext()); |
40 FilePath cache_path(ConvertJavaStringToUTF8(path)); | 40 FilePath cache_path(ConvertJavaStringToUTF8(path)); |
41 *result = cache_path; | 41 *result = cache_path; |
42 return true; | 42 return true; |
43 } | 43 } |
44 | 44 |
45 bool GetThumbnailCacheDirectory(FilePath* result) { | 45 bool GetThumbnailCacheDirectory(FilePath* result) { |
46 JNIEnv* env = AttachCurrentThread(); | 46 JNIEnv* env = AttachCurrentThread(); |
47 ScopedJavaLocalRef<jstring> path = | 47 ScopedJavaLocalRef<jstring> path = |
48 Java_PathUtils_getThumbnailCacheDirectoryPath(env, | 48 Java_PathUtils_getThumbnailCacheDirectory(env, GetApplicationContext()); |
49 GetApplicationContext()); | |
50 FilePath thumbnail_cache_path(ConvertJavaStringToUTF8(path)); | 49 FilePath thumbnail_cache_path(ConvertJavaStringToUTF8(path)); |
51 *result = thumbnail_cache_path; | 50 *result = thumbnail_cache_path; |
52 return true; | 51 return true; |
53 } | 52 } |
54 | 53 |
55 bool GetDownloadsDirectory(FilePath* result) { | 54 bool GetDownloadsDirectory(FilePath* result) { |
56 JNIEnv* env = AttachCurrentThread(); | 55 JNIEnv* env = AttachCurrentThread(); |
57 ScopedJavaLocalRef<jstring> path = | 56 ScopedJavaLocalRef<jstring> path = |
58 Java_PathUtils_getDownloadsDirectory(env, GetApplicationContext()); | 57 Java_PathUtils_getDownloadsDirectory(env, GetApplicationContext()); |
59 FilePath downloads_path(ConvertJavaStringToUTF8(path)); | 58 FilePath downloads_path(ConvertJavaStringToUTF8(path)); |
(...skipping 18 matching lines...) Expand all Loading... |
78 *result = storage_path; | 77 *result = storage_path; |
79 return true; | 78 return true; |
80 } | 79 } |
81 | 80 |
82 bool RegisterPathUtils(JNIEnv* env) { | 81 bool RegisterPathUtils(JNIEnv* env) { |
83 return RegisterNativesImpl(env); | 82 return RegisterNativesImpl(env); |
84 } | 83 } |
85 | 84 |
86 } // namespace android | 85 } // namespace android |
87 } // namespace base | 86 } // namespace base |
OLD | NEW |