#ifndef WebHTTPBody_h
#define WebHTTPBody_h
#include "WebBlobData.h"
#include "WebData.h"
#include "WebNonCopyable.h"
#include "WebString.h"
#include "WebURL.h"
#if INSIDE_BLINK
namespace WebCore { class FormData; }
namespace WTF { template <typename T> class PassRefPtr; }
#endif
namespace blink {
class WebHTTPBodyPrivate;
class WebHTTPBody {
public:
struct Element {
enum Type { TypeData, TypeFile, TypeBlob, TypeFileSystemURL } type;
WebData data;
WebString filePath;
long long fileStart;
long long fileLength;
double modificationTime;
WebURL fileSystemURL;
WebString blobUUID;
};
~WebHTTPBody() { reset(); }
WebHTTPBody() : m_private(0) { }
WebHTTPBody(const WebHTTPBody& b) : m_private(0) { assign(b); }
WebHTTPBody& operator=(const WebHTTPBody& b)
{
assign(b);
return *this;
}
BLINK_PLATFORM_EXPORT void initialize();
BLINK_PLATFORM_EXPORT void reset();
BLINK_PLATFORM_EXPORT void assign(const WebHTTPBody&);
bool isNull() const { return !m_private; }
BLINK_PLATFORM_EXPORT size_t elementCount() const;
BLINK_PLATFORM_EXPORT bool elementAt(size_t index, Element&) const;
BLINK_PLATFORM_EXPORT void appendData(const WebData&);
BLINK_PLATFORM_EXPORT void appendFile(const WebString&);
BLINK_PLATFORM_EXPORT void appendFileRange(const WebString&, long long fileStart, long long fileLength, double modificationTime);
BLINK_PLATFORM_EXPORT void appendBlob(const WebString& uuid);
BLINK_PLATFORM_EXPORT void appendFileSystemURLRange(const WebURL&, long long start, long long length, double modificationTime);
BLINK_PLATFORM_EXPORT long long identifier() const;
BLINK_PLATFORM_EXPORT void setIdentifier(long long);
BLINK_PLATFORM_EXPORT bool containsPasswordData() const;
BLINK_PLATFORM_EXPORT void setContainsPasswordData(bool);
#if INSIDE_BLINK
BLINK_PLATFORM_EXPORT WebHTTPBody(const WTF::PassRefPtr<WebCore::FormData>&);
BLINK_PLATFORM_EXPORT WebHTTPBody& operator=(const WTF::PassRefPtr<WebCore::FormData>&);
BLINK_PLATFORM_EXPORT operator WTF::PassRefPtr<WebCore::FormData>() const;
#endif
private:
BLINK_PLATFORM_EXPORT void assign(WebHTTPBodyPrivate*);
BLINK_PLATFORM_EXPORT void ensureMutable();
WebHTTPBodyPrivate* m_private;
};
}
#endif