1// Copyright 2014 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef CONTENT_BROWSER_ANDROID_JAVA_GIN_JAVA_SCRIPT_TO_JAVA_TYPES_COERCION_H_ 6#define CONTENT_BROWSER_ANDROID_JAVA_GIN_JAVA_SCRIPT_TO_JAVA_TYPES_COERCION_H_ 7 8#include <map> 9 10#include "base/android/jni_weak_ref.h" 11#include "base/values.h" 12#include "content/browser/android/java/gin_java_bound_object.h" 13#include "content/browser/android/java/java_type.h" 14#include "content/common/android/gin_java_bridge_errors.h" 15 16namespace content { 17 18typedef std::map<GinJavaBoundObject::ObjectID, JavaObjectWeakGlobalRef> 19 ObjectRefs; 20 21jvalue CoerceJavaScriptValueToJavaValue( 22 JNIEnv* env, 23 const base::Value* value, 24 const JavaType& target_type, 25 bool coerce_to_string, 26 const ObjectRefs& object_refs, 27 GinJavaBridgeError* error); 28 29void ReleaseJavaValueIfRequired(JNIEnv* env, 30 jvalue* value, 31 const JavaType& type); 32 33} // namespace content 34 35#endif // CONTENT_BROWSER_ANDROID_JAVA_GIN_JAVA_SCRIPT_TO_JAVA_TYPES_COERCION_H_ 36