| 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_ARRAY_H_ | 5 #ifndef BASE_ANDROID_JNI_ARRAY_H_ |
| 6 #define BASE_ANDROID_JNI_ARRAY_H_ | 6 #define BASE_ANDROID_JNI_ARRAY_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/android/scoped_java_ref.h" | 12 #include "base/android/scoped_java_ref.h" |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 namespace android { | 17 namespace android { |
| 18 | 18 |
| 19 // Returns a new Java byte array converted from the given bytes array. | 19 // Returns a new Java byte array converted from the given bytes array. |
| 20 BASE_EXPORT ScopedJavaLocalRef<jbyteArray> ToJavaByteArray( | 20 BASE_EXPORT ScopedJavaLocalRef<jbyteArray> ToJavaByteArray( |
| 21 JNIEnv* env, const uint8* bytes, size_t len); | 21 JNIEnv* env, const uint8* bytes, size_t len); |
| 22 | 22 |
| 23 // Returns a new Java int array converted from the given int array. |
| 24 BASE_EXPORT ScopedJavaLocalRef<jintArray> ToJavaIntArray( |
| 25 JNIEnv* env, const int* ints, size_t len); |
| 26 |
| 27 BASE_EXPORT ScopedJavaLocalRef<jintArray> ToJavaIntArray( |
| 28 JNIEnv* env, const std::vector<int>& ints); |
| 29 |
| 23 // Returns a new Java long array converted from the given int64 array. | 30 // Returns a new Java long array converted from the given int64 array. |
| 24 BASE_EXPORT ScopedJavaLocalRef<jlongArray> ToJavaLongArray( | 31 BASE_EXPORT ScopedJavaLocalRef<jlongArray> ToJavaLongArray( |
| 25 JNIEnv* env, const int64* longs, size_t len); | 32 JNIEnv* env, const int64* longs, size_t len); |
| 26 | 33 |
| 27 BASE_EXPORT ScopedJavaLocalRef<jlongArray> ToJavaLongArray( | 34 BASE_EXPORT ScopedJavaLocalRef<jlongArray> ToJavaLongArray( |
| 28 JNIEnv* env, const std::vector<int64>& longs); | 35 JNIEnv* env, const std::vector<int64>& longs); |
| 29 | 36 |
| 30 // Returns a array of Java byte array converted from |v|. | 37 // Returns a array of Java byte array converted from |v|. |
| 31 BASE_EXPORT ScopedJavaLocalRef<jobjectArray> ToJavaArrayOfByteArray( | 38 BASE_EXPORT ScopedJavaLocalRef<jobjectArray> ToJavaArrayOfByteArray( |
| 32 JNIEnv* env, const std::vector<std::string>& v); | 39 JNIEnv* env, const std::vector<std::string>& v); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // conversion is performed. | 84 // conversion is performed. |
| 78 BASE_EXPORT void JavaArrayOfByteArrayToStringVector( | 85 BASE_EXPORT void JavaArrayOfByteArrayToStringVector( |
| 79 JNIEnv* env, | 86 JNIEnv* env, |
| 80 jobjectArray array, | 87 jobjectArray array, |
| 81 std::vector<std::string>* out); | 88 std::vector<std::string>* out); |
| 82 | 89 |
| 83 } // namespace android | 90 } // namespace android |
| 84 } // namespace base | 91 } // namespace base |
| 85 | 92 |
| 86 #endif // BASE_ANDROID_JNI_ARRAY_H_ | 93 #endif // BASE_ANDROID_JNI_ARRAY_H_ |
| OLD | NEW |