1 2 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 6 #include <string> 7 8 #include "base/string16.h" 9 #include "nativehelper/jni.h" 10 11 namespace android { 12 13 namespace jni { // To avoid name conflict with similar functions in webkit 14 15 void SetJavaVM(JavaVM* vm); 16 17 // Get the JNI environment for the current thread. 18 JNIEnv* GetJNIEnv(); 19 20 // Convert Java String to std::string. On null input, returns an empty string. 21 std::string JstringToStdString(JNIEnv* env, jstring jstr); 22 23 string16 JstringToString16(JNIEnv* env, jstring jstr); 24 25 jstring ConvertUTF8ToJavaString(JNIEnv* env, std::string str); 26 27 bool CheckException(JNIEnv*); 28 29 void DetachFromVM(); 30 31 } // namespace jni 32 33 } // namespace android 34 35