Index: Source/core/html/FormDataList.h |
diff --git a/Source/core/html/FormDataList.h b/Source/core/html/FormDataList.h |
index a02fb79621c924b9ead709a69ee7bf7a0d2a75dd..e8eb3b6c3b9f1220977b74a1b247dcca28aad6ce 100644 |
--- a/Source/core/html/FormDataList.h |
+++ b/Source/core/html/FormDataList.h |
@@ -22,6 +22,7 @@ |
#define FormDataList_h |
#include "core/fileapi/Blob.h" |
+#include "core/fileapi/File.h" |
#include "platform/heap/Handle.h" |
#include "platform/network/FormData.h" |
#include "wtf/Forward.h" |
@@ -32,6 +33,32 @@ namespace blink { |
class FormDataList { |
public: |
+ class Entry FINAL { |
+ ALLOW_ONLY_INLINE_ALLOCATION(); |
+ public: |
+ enum Type { None, StringType, FileType }; |
+ |
+ Entry() : m_type(None) { } |
+ Entry(const String& name, const String& value) : m_type(StringType), m_name(name), m_string(value) { } |
+ Entry(const String& name, PassRefPtrWillBeRawPtr<File> value) : m_type(FileType), m_name(name), m_file(value) { } |
+ |
+ bool isNone() const { return m_type == None; } |
+ bool isString() const { return m_type == StringType; } |
+ bool isFile() const { return m_type == FileType; } |
+ |
+ const String& name() const { ASSERT(m_type != None); return m_name; } |
+ const String& string() const { ASSERT(m_type == StringType); return m_string; } |
+ PassRefPtrWillBeRawPtr<File> file() const { ASSERT(m_type == FileType); return m_file; } |
+ |
+ void trace(Visitor*); |
+ |
+ private: |
+ const Type m_type; |
+ const String m_name; |
+ const String m_string; |
+ const RefPtrWillBeMember<File> m_file; |
+ }; |
+ |
class Item { |
ALLOW_ONLY_INLINE_ALLOCATION(); |
public: |
@@ -74,6 +101,15 @@ public: |
appendBlob(blob, filename); |
} |
+ void deleteEntry(const String& key); |
+ Entry getEntry(const String& key) const; |
+ Entry getEntry(size_t index) const; |
+ WillBeHeapVector<Entry> getAll(const String& key) const; |
+ bool hasEntry(const String& key) const; |
+ void setBlob(const String& key, PassRefPtrWillBeRawPtr<Blob>, const String& filename); |
+ void setData(const String& key, const String& value); |
+ size_t size() const { return m_items.size() / 2; } |
+ |
const WillBeHeapVector<Item>& items() const { return m_items; } |
const WTF::TextEncoding& encoding() const { return m_encoding; } |
@@ -88,6 +124,9 @@ private: |
void appendString(const CString&); |
void appendString(const String&); |
void appendBlob(PassRefPtrWillBeRawPtr<Blob>, const String& filename); |
+ void setEntry(const String& key, const Item&); |
+ Entry itemsToEntry(const Item& key, const Item& value) const; |
+ CString encodeAndNormalize(const String& key) const; |
WTF::TextEncoding m_encoding; |
WillBeHeapVector<Item> m_items; |