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