Chromium Code Reviews| Index: base/android/jni_local_ref_extensions.h |
| diff --git a/base/android/jni_local_ref_extensions.h b/base/android/jni_local_ref_extensions.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8370afbd8e64eb97906c6c9dbf7f75ef263dee65 |
| --- /dev/null |
| +++ b/base/android/jni_local_ref_extensions.h |
| @@ -0,0 +1,29 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef BASE_ANDROID_JNI_LOCAL_REF_EXTENSIONS_H_ |
| +#define BASE_ANDROID_JNI_LOCAL_REF_EXTENSIONS_H_ |
| + |
| +#include "base/android/jni_android.h" |
| +#include "base/android/jni_array.h" |
| +#include "base/android/jni_string.h" |
| + |
| +namespace base { |
| +namespace android { |
| + |
| +// Returns an empty string if java string is null, |
| +// otherwise converts and returns the string. |
| +string16 SafeJavaStringToUTF16(const ScopedJavaLocalRef<jstring>& jstring); |
|
Yaron
2013/03/13 21:23:23
To be honest, I don't see why we need these additi
apiccion
2013/03/15 00:59:13
Done.
|
| + |
| +// Fills |string_vector| with the contents of |jarray|. |
| +// If the Java array is null, then |string_vector| is not modified. |
| +void SafeJavaStringArrayToStringVector( |
| + const ScopedJavaLocalRef<jobjectArray>& jarray, |
| + JNIEnv* env, |
| + std::vector<string16>* string_vector); |
| + |
| +} // namespace android |
| +} // namespace base |
| + |
| +#endif // BASE_ANDROID_JNI_LOCAL_REF_EXTENSIONS_H_ |