Index: content/public/common/resource_request_body.h |
diff --git a/content/public/common/resource_request_body.h b/content/public/common/resource_request_body.h |
index 0634706b418dec78824fba52645f32aa184d9052..061d1bc055d792bac1a14a141504927c9f90cf8c 100644 |
--- a/content/public/common/resource_request_body.h |
+++ b/content/public/common/resource_request_body.h |
@@ -7,17 +7,38 @@ |
#include <stdint.h> |
+#include <string> |
#include <vector> |
#include "base/macros.h" |
#include "base/memory/ref_counted.h" |
+#include "build/build_config.h" |
#include "content/common/content_export.h" |
+#if defined(OS_ANDROID) |
+#include <jni.h> |
+#include "base/android/scoped_java_ref.h" |
+#endif |
+ |
namespace content { |
// ResourceRequestBody represents body (i.e. upload data) of a HTTP request. |
class CONTENT_EXPORT ResourceRequestBody |
: public base::RefCountedThreadSafe<ResourceRequestBody> { |
+ public: |
+ // Creates ResourceRequestBody that holds a copy of |bytes|. |
+ static scoped_refptr<ResourceRequestBody> CreateFromBytes(const char* bytes, |
+ size_t length); |
+ static scoped_refptr<ResourceRequestBody> CreateFromBytes( |
+ const std::string& bytes); |
+ |
+#if defined(OS_ANDROID) |
+ // Converts ResourceRequestBody to a Java byte array. |
+ // Works only for ResourceRequestBodies created via CreateFromBytes above. |
+ virtual base::android::ScopedJavaLocalRef<jbyteArray> ToJavaByteArray( |
+ JNIEnv* env) const = 0; |
+#endif |
+ |
protected: |
ResourceRequestBody(); |
virtual ~ResourceRequestBody(); |