Index: WebCore/platform/network/FormData.h |
diff --git a/WebCore/platform/network/FormData.h b/WebCore/platform/network/FormData.h |
index a4390234796a0e2f14f5d349f5dd0effc0a4b7cd..773c901d7528b07cd4b3eda586eeb4fca5987be0 100644 |
--- a/WebCore/platform/network/FormData.h |
+++ b/WebCore/platform/network/FormData.h |
@@ -20,21 +20,25 @@ |
#ifndef FormData_h |
#define FormData_h |
+#include "BlobItem.h" |
#include "PlatformString.h" |
#include <wtf/RefCounted.h> |
#include <wtf/Vector.h> |
namespace WebCore { |
-class DOMFormData; |
class Document; |
+class TextEncoding; |
+// A wrapper class of BlobItem for FormData. |
class FormDataElement { |
public: |
- FormDataElement() : m_type(data) { } |
+ FormDataElement() : m_data(0) { } |
FormDataElement(const Vector<char>& array) : m_type(data), m_data(array) { } |
+ |
#if ENABLE(BLOB_SLICE) |
- FormDataElement(const String& filename, long long fileStart, long long fileLength, double expectedFileModificationTime, bool shouldGenerateFile) : m_type(encodedFile), m_filename(filename), m_fileStart(fileStart), m_fileLength(fileLength), m_expectedFileModificationTime(expectedFileModificationTime), m_shouldGenerateFile(shouldGenerateFile) { } |
+ FormDataElement(const String& filename, long long fileStart, long long fileLength, double expectedFileModificationTime, bool shouldGenerateFile) : m_type(encodedFile), m_filename(filename), m_fileStart(fileStart), m_fileLength(fileLength), m_expectedFileModificationTime(expectedFileModificationTime), m_shouldGenerateFile(shouldGenerateFile) { |
+ } |
#else |
FormDataElement(const String& filename, bool shouldGenerateFile) : m_type(encodedFile), m_filename(filename), m_shouldGenerateFile(shouldGenerateFile) { } |
#endif |
@@ -46,6 +50,9 @@ public: |
long long m_fileStart; |
long long m_fileLength; |
double m_expectedFileModificationTime; |
+ |
+ static const long long toEndOfFile; |
+ static const double doNotCheckFileChange; |
#endif |
String m_generatedFilename; |
bool m_shouldGenerateFile; |
@@ -55,7 +62,7 @@ inline bool operator==(const FormDataElement& a, const FormDataElement& b) |
{ |
if (&a == &b) |
return true; |
- |
+ |
if (a.m_type != b.m_type) |
return false; |
if (a.m_data != b.m_data) |
@@ -69,25 +76,26 @@ inline bool operator==(const FormDataElement& a, const FormDataElement& b) |
return true; |
} |
- |
+ |
inline bool operator!=(const FormDataElement& a, const FormDataElement& b) |
{ |
return !(a == b); |
} |
- |
+ |
class FormData : public RefCounted<FormData> { |
public: |
static PassRefPtr<FormData> create(); |
static PassRefPtr<FormData> create(const void*, size_t); |
static PassRefPtr<FormData> create(const WTF::CString&); |
static PassRefPtr<FormData> create(const Vector<char>&); |
- static PassRefPtr<FormData> create(const DOMFormData&); |
- static PassRefPtr<FormData> createMultiPart(const DOMFormData&, Document*); |
+ static PassRefPtr<FormData> create(const BlobItemList&, const TextEncoding&); |
+ static PassRefPtr<FormData> createMultiPart(const BlobItemList&, const TextEncoding&, Document*); |
PassRefPtr<FormData> copy() const; |
PassRefPtr<FormData> deepCopy() const; |
~FormData(); |
- |
+ |
void appendData(const void* data, size_t); |
+ void appendItems(const BlobItemList&); |
void appendFile(const String& filename, bool shouldGenerateFile = false); |
#if ENABLE(BLOB_SLICE) |
void appendFileRange(const String& filename, long long start, long long length, double expectedModificationTime, bool shouldGenerateFile = false); |
@@ -115,9 +123,11 @@ private: |
FormData(); |
FormData(const FormData&); |
- void appendDOMFormData(const DOMFormData& domFormData, bool isMultiPartForm, Document* document); |
+ void appendItem(const BlobItem*, bool shouldGenerateFile); |
+ void appendKeyValuePairItems(const BlobItemList&, const TextEncoding&, bool isMultiPartForm, Document*); |
Vector<FormDataElement> m_elements; |
+ |
int64_t m_identifier; |
bool m_hasGeneratedFiles; |
bool m_alwaysStream; |
@@ -131,7 +141,7 @@ inline bool operator==(const FormData& a, const FormData& b) |
inline bool operator!=(const FormData& a, const FormData& b) |
{ |
- return a.elements() != b.elements(); |
+ return !(a == b); |
} |
} // namespace WebCore |