| 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/string_piece.h" | 13 #include "base/string_piece.h" |
| 13 | 14 |
| 14 namespace base { | 15 namespace base { |
| 15 namespace android { | 16 namespace android { |
| 16 | 17 |
| 17 // Convert a Java string to UTF8. Returns a std string. | 18 // Convert a Java string to UTF8. Returns a std string. |
| 18 std::string ConvertJavaStringToUTF8(JNIEnv* env, jstring str); | 19 BASE_EXPORT std::string ConvertJavaStringToUTF8(JNIEnv* env, jstring str); |
| 19 std::string ConvertJavaStringToUTF8(const JavaRef<jstring>& str); | 20 BASE_EXPORT std::string ConvertJavaStringToUTF8(const JavaRef<jstring>& str); |
| 20 | 21 |
| 21 // Convert a std string to Java string. | 22 // Convert a std string to Java string. |
| 22 ScopedJavaLocalRef<jstring> ConvertUTF8ToJavaString( | 23 BASE_EXPORT ScopedJavaLocalRef<jstring> ConvertUTF8ToJavaString( |
| 23 JNIEnv* env, | 24 JNIEnv* env, |
| 24 const base::StringPiece& str); | 25 const base::StringPiece& str); |
| 25 | 26 |
| 26 // Convert a Java string to UTF16. Returns a string16. | 27 // Convert a Java string to UTF16. Returns a string16. |
| 27 string16 ConvertJavaStringToUTF16(JNIEnv* env, jstring str); | 28 BASE_EXPORT string16 ConvertJavaStringToUTF16(JNIEnv* env, jstring str); |
| 28 string16 ConvertJavaStringToUTF16(const JavaRef<jstring>& str); | 29 BASE_EXPORT string16 ConvertJavaStringToUTF16(const JavaRef<jstring>& str); |
| 29 | 30 |
| 30 // Convert a string16 to a Java string. | 31 // Convert a string16 to a Java string. |
| 31 ScopedJavaLocalRef<jstring> ConvertUTF16ToJavaString( | 32 BASE_EXPORT ScopedJavaLocalRef<jstring> ConvertUTF16ToJavaString( |
| 32 JNIEnv* env, | 33 JNIEnv* env, |
| 33 const base::StringPiece16& str); | 34 const base::StringPiece16& str); |
| 34 | 35 |
| 35 } // namespace android | 36 } // namespace android |
| 36 } // namespace base | 37 } // namespace base |
| 37 | 38 |
| 38 #endif // BASE_ANDROID_JNI_STRING_H_ | 39 #endif // BASE_ANDROID_JNI_STRING_H_ |
| OLD | NEW |