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

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

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « base/android/path_utils.h ('k') | base/android/path_utils_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/android/path_utils.h"
6
7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h"
9 #include "base/android/scoped_java_ref.h"
10 #include "base/files/file_path.h"
11
12 #include "jni/PathUtils_jni.h"
13
14 namespace base {
15 namespace android {
16
17 bool GetDataDirectory(FilePath* result) {
18 JNIEnv* env = AttachCurrentThread();
19 ScopedJavaLocalRef<jstring> path =
20 Java_PathUtils_getDataDirectory(env, GetApplicationContext());
21 FilePath data_path(ConvertJavaStringToUTF8(path));
22 *result = data_path;
23 return true;
24 }
25
26 bool GetDatabaseDirectory(FilePath* result) {
27 JNIEnv* env = AttachCurrentThread();
28 ScopedJavaLocalRef<jstring> path =
29 Java_PathUtils_getDatabaseDirectory(env, GetApplicationContext());
30 FilePath data_path(ConvertJavaStringToUTF8(path));
31 *result = data_path;
32 return true;
33 }
34
35 bool GetCacheDirectory(FilePath* result) {
36 JNIEnv* env = AttachCurrentThread();
37 ScopedJavaLocalRef<jstring> path =
38 Java_PathUtils_getCacheDirectory(env, GetApplicationContext());
39 FilePath cache_path(ConvertJavaStringToUTF8(path));
40 *result = cache_path;
41 return true;
42 }
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
54 bool GetDownloadsDirectory(FilePath* result) {
55 JNIEnv* env = AttachCurrentThread();
56 ScopedJavaLocalRef<jstring> path =
57 Java_PathUtils_getDownloadsDirectory(env, GetApplicationContext());
58 FilePath downloads_path(ConvertJavaStringToUTF8(path));
59 *result = downloads_path;
60 return true;
61 }
62
63 bool GetNativeLibraryDirectory(FilePath* result) {
64 JNIEnv* env = AttachCurrentThread();
65 ScopedJavaLocalRef<jstring> path =
66 Java_PathUtils_getNativeLibraryDirectory(env, GetApplicationContext());
67 FilePath library_path(ConvertJavaStringToUTF8(path));
68 *result = library_path;
69 return true;
70 }
71
72 bool GetExternalStorageDirectory(FilePath* result) {
73 JNIEnv* env = AttachCurrentThread();
74 ScopedJavaLocalRef<jstring> path =
75 Java_PathUtils_getExternalStorageDirectory(env);
76 FilePath storage_path(ConvertJavaStringToUTF8(path));
77 *result = storage_path;
78 return true;
79 }
80
81 bool RegisterPathUtils(JNIEnv* env) {
82 return RegisterNativesImpl(env);
83 }
84
85 } // namespace android
86 } // namespace base
OLDNEW
« no previous file with comments | « base/android/path_utils.h ('k') | base/android/path_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698