| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "core/fileapi/Blob.h" | 25 #include "core/fileapi/Blob.h" |
| 26 #include "core/fileapi/File.h" | 26 #include "core/fileapi/File.h" |
| 27 #include "platform/heap/Handle.h" | 27 #include "platform/heap/Handle.h" |
| 28 #include "platform/network/FormData.h" | 28 #include "platform/network/FormData.h" |
| 29 #include "wtf/Forward.h" | 29 #include "wtf/Forward.h" |
| 30 #include "wtf/text/CString.h" | 30 #include "wtf/text/CString.h" |
| 31 #include "wtf/text/TextEncoding.h" | 31 #include "wtf/text/TextEncoding.h" |
| 32 | 32 |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 // TODO(tkent): Merge FormDataList into DOMFormData. |
| 35 class CORE_EXPORT FormDataList : public GarbageCollected<FormDataList> { | 36 class CORE_EXPORT FormDataList : public GarbageCollected<FormDataList> { |
| 36 public: | 37 public: |
| 37 // TODO(tkent): Merge Entry and Item. | 38 // TODO(tkent): Merge Entry and Item. |
| 38 class Entry final { | 39 class Entry final { |
| 39 ALLOW_ONLY_INLINE_ALLOCATION(); | 40 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 40 public: | 41 public: |
| 41 enum Type { None, StringType, FileType }; | 42 enum Type { None, StringType, FileType }; |
| 42 | 43 |
| 43 Entry() : m_type(None) { } | 44 Entry() : m_type(None) { } |
| 44 Entry(const String& name, const String& value) : m_type(StringType), m_n
ame(name), m_string(value) { } | 45 Entry(const String& name, const String& value) : m_type(StringType), m_n
ame(name), m_string(value) { } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 75 | 76 |
| 76 DECLARE_TRACE(); | 77 DECLARE_TRACE(); |
| 77 | 78 |
| 78 private: | 79 private: |
| 79 CString m_key; | 80 CString m_key; |
| 80 WTF::CString m_data; | 81 WTF::CString m_data; |
| 81 Member<Blob> m_blob; | 82 Member<Blob> m_blob; |
| 82 String m_filename; | 83 String m_filename; |
| 83 }; | 84 }; |
| 84 | 85 |
| 85 static FormDataList* create(const WTF::TextEncoding& encoding) | |
| 86 { | |
| 87 return new FormDataList(encoding); | |
| 88 } | |
| 89 | |
| 90 using FormDataListItems = HeapVector<FormDataList::Item>; | 86 using FormDataListItems = HeapVector<FormDataList::Item>; |
| 91 | 87 |
| 92 void appendData(const String& key, const String& value) | 88 void appendData(const String& key, const String& value) |
| 93 { | 89 { |
| 94 appendItem(Item(encodeAndNormalize(key), encodeAndNormalize(value))); | 90 appendItem(Item(encodeAndNormalize(key), encodeAndNormalize(value))); |
| 95 } | 91 } |
| 96 void appendData(const String& key, const CString& value) | 92 void appendData(const String& key, const CString& value) |
| 97 { | 93 { |
| 98 appendItem(Item(encodeAndNormalize(key), value)); | 94 appendItem(Item(encodeAndNormalize(key), value)); |
| 99 } | 95 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 WTF::TextEncoding m_encoding; | 133 WTF::TextEncoding m_encoding; |
| 138 FormDataListItems m_items; | 134 FormDataListItems m_items; |
| 139 }; | 135 }; |
| 140 | 136 |
| 141 } // namespace blink | 137 } // namespace blink |
| 142 | 138 |
| 143 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::FormDataList::Entry); | 139 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::FormDataList::Entry); |
| 144 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::FormDataList::Item); | 140 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::FormDataList::Item); |
| 145 | 141 |
| 146 #endif // FormDataList_h | 142 #endif // FormDataList_h |
| OLD | NEW |