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/base_api.h" 9 #include "base/string16.h" 10 #include "nativehelper/jni.h" 11 12 namespace android { 13 14 namespace jni { // To avoid name conflict with similar functions in webkit 15 16 void BASE_API SetJavaVM(JavaVM* vm); 17 18 // Get the JNI environment for the current thread. 19 JNIEnv* GetJNIEnv(); 20 21 // Convert Java String to std::string. On null input, returns an empty string. 22 std::string JstringToStdString(JNIEnv* env, jstring jstr); 23 24 string16 JstringToString16(JNIEnv* env, jstring jstr); 25 26 jstring ConvertUTF8ToJavaString(JNIEnv* env, std::string str); 27 28 bool CheckException(JNIEnv*); 29 30 void DetachFromVM(); 31 32 } // namespace jni 33 34 } // namespace android 35 36