1 // Copyright 2016 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_PUBLIC_COMMON_RESOURCE_REQUEST_BODY_ANDROID_H_ 6 #define CONTENT_PUBLIC_COMMON_RESOURCE_REQUEST_BODY_ANDROID_H_ 7 8 #include <jni.h> 9 10 #include "base/android/scoped_java_ref.h" 11 #include "base/memory/ref_counted.h" 12 #include "content/common/content_export.h" 13 14 namespace network { 15 class ResourceRequestBody; 16 } 17 18 namespace content { 19 20 // Returns an instance of org.chromium.content_public.common.ResourceRequestBody 21 // that contains serialized representation of the |native_object|. 22 CONTENT_EXPORT base::android::ScopedJavaLocalRef<jobject> 23 ConvertResourceRequestBodyToJavaObject( 24 JNIEnv* env, 25 const scoped_refptr<network::ResourceRequestBody>& native_object); 26 27 // Reconstructs the native C++ network::ResourceRequestBody object based on 28 // org.chromium.content_public.common.ResourceRequestBody (|java_object|) passed 29 // in as an argument. 30 CONTENT_EXPORT scoped_refptr<network::ResourceRequestBody> 31 ExtractResourceRequestBodyFromJavaObject( 32 JNIEnv* env, 33 const base::android::JavaParamRef<jobject>& java_object); 34 35 } // namespace content 36 37 #endif // CONTENT_PUBLIC_COMMON_RESOURCE_REQUEST_BODY_ANDROID_H_ 38