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 #ifndef BASE_ANDROID_JNI_STRING_H_ | 5 #ifndef BASE_ANDROID_JNI_STRING_H_ |
6 #define BASE_ANDROID_JNI_STRING_H_ | 6 #define BASE_ANDROID_JNI_STRING_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
12 #include "base/base_export.h" | 12 #include "base/base_export.h" |
13 #include "base/string_piece.h" | 13 #include "base/strings/string_piece.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 namespace android { | 16 namespace android { |
17 | 17 |
18 // Convert a Java string to UTF8. Returns a std string. | 18 // Convert a Java string to UTF8. Returns a std string. |
19 BASE_EXPORT void ConvertJavaStringToUTF8(JNIEnv* env, | 19 BASE_EXPORT void ConvertJavaStringToUTF8(JNIEnv* env, |
20 jstring str, | 20 jstring str, |
21 std::string* result); | 21 std::string* result); |
22 BASE_EXPORT std::string ConvertJavaStringToUTF8(JNIEnv* env, jstring str); | 22 BASE_EXPORT std::string ConvertJavaStringToUTF8(JNIEnv* env, jstring str); |
23 BASE_EXPORT std::string ConvertJavaStringToUTF8(const JavaRef<jstring>& str); | 23 BASE_EXPORT std::string ConvertJavaStringToUTF8(const JavaRef<jstring>& str); |
(...skipping 12 matching lines...) Expand all Loading... |
36 | 36 |
37 // Convert a string16 to a Java string. | 37 // Convert a string16 to a Java string. |
38 BASE_EXPORT ScopedJavaLocalRef<jstring> ConvertUTF16ToJavaString( | 38 BASE_EXPORT ScopedJavaLocalRef<jstring> ConvertUTF16ToJavaString( |
39 JNIEnv* env, | 39 JNIEnv* env, |
40 const base::StringPiece16& str); | 40 const base::StringPiece16& str); |
41 | 41 |
42 } // namespace android | 42 } // namespace android |
43 } // namespace base | 43 } // namespace base |
44 | 44 |
45 #endif // BASE_ANDROID_JNI_STRING_H_ | 45 #endif // BASE_ANDROID_JNI_STRING_H_ |
OLD | NEW |