OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 10 matching lines...) Expand all Loading... |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef DOMFormData_h | 31 #ifndef FormData_h |
32 #define DOMFormData_h | 32 #define FormData_h |
33 | 33 |
34 #include "bindings/core/v8/Iterable.h" | 34 #include "bindings/core/v8/Iterable.h" |
35 #include "bindings/core/v8/ScriptState.h" | 35 #include "bindings/core/v8/ScriptState.h" |
36 #include "bindings/core/v8/UnionTypesCore.h" | 36 #include "bindings/core/v8/UnionTypesCore.h" |
37 #include "core/CoreExport.h" | 37 #include "core/CoreExport.h" |
38 #include "core/html/FormDataList.h" | 38 #include "core/html/FormDataList.h" |
39 #include "platform/heap/Handle.h" | 39 #include "platform/heap/Handle.h" |
40 #include "wtf/Forward.h" | 40 #include "wtf/Forward.h" |
41 | 41 |
42 namespace WTF { | 42 namespace WTF { |
43 class TextEncoding; | 43 class TextEncoding; |
44 } | 44 } |
45 | 45 |
46 namespace blink { | 46 namespace blink { |
47 | 47 |
48 class Blob; | 48 class Blob; |
49 class HTMLFormElement; | 49 class HTMLFormElement; |
50 | 50 |
51 // Typedef from FormData.idl: | 51 // Typedef from FormData.idl: |
52 typedef FileOrUSVString FormDataEntryValue; | 52 typedef FileOrUSVString FormDataEntryValue; |
53 | 53 |
54 class CORE_EXPORT DOMFormData final : public FormDataList, public ScriptWrappabl
e, public PairIterable<String, FormDataEntryValue> { | 54 class CORE_EXPORT FormData final : public FormDataList, public ScriptWrappable,
public PairIterable<String, FormDataEntryValue> { |
55 DEFINE_WRAPPERTYPEINFO(); | 55 DEFINE_WRAPPERTYPEINFO(); |
56 | 56 |
57 public: | 57 public: |
58 static DOMFormData* create(HTMLFormElement* form = 0) | 58 static FormData* create(HTMLFormElement* form = 0) |
59 { | 59 { |
60 return new DOMFormData(form); | 60 return new FormData(form); |
61 } | 61 } |
62 | 62 |
63 static DOMFormData* create(const WTF::TextEncoding& encoding) | 63 static FormData* create(const WTF::TextEncoding& encoding) |
64 { | 64 { |
65 return new DOMFormData(encoding); | 65 return new FormData(encoding); |
66 } | 66 } |
67 | 67 |
68 // FormData interface. | 68 // FormData interface. |
69 void append(const String& name, const String& value); | 69 void append(const String& name, const String& value); |
70 void append(ExecutionContext*, const String& name, Blob*, const String& file
name = String()); | 70 void append(ExecutionContext*, const String& name, Blob*, const String& file
name = String()); |
71 void deleteEntry(const String& name); | 71 void deleteEntry(const String& name); |
72 void get(const String& name, FormDataEntryValue& result); | 72 void get(const String& name, FormDataEntryValue& result); |
73 HeapVector<FormDataEntryValue> getAll(const String& name); | 73 HeapVector<FormDataEntryValue> getAll(const String& name); |
74 bool has(const String& name); | 74 bool has(const String& name); |
75 void set(const String& name, const String& value); | 75 void set(const String& name, const String& value); |
76 void set(const String& name, Blob*, const String& filename = String()); | 76 void set(const String& name, Blob*, const String& filename = String()); |
77 | 77 |
78 void makeOpaque() { m_opaque = true; } | 78 void makeOpaque() { m_opaque = true; } |
79 bool opaque() const { return m_opaque; } | 79 bool opaque() const { return m_opaque; } |
80 | 80 |
81 String decode(const CString& data) const; | 81 String decode(const CString& data) const; |
82 | 82 |
83 private: | 83 private: |
84 explicit DOMFormData(const WTF::TextEncoding&); | 84 explicit FormData(const WTF::TextEncoding&); |
85 explicit DOMFormData(HTMLFormElement*); | 85 explicit FormData(HTMLFormElement*); |
86 void setEntry(const Item&); | 86 void setEntry(const Item&); |
87 | 87 |
88 IterationSource* startIteration(ScriptState*, ExceptionState&) override; | 88 IterationSource* startIteration(ScriptState*, ExceptionState&) override; |
89 bool m_opaque; | 89 bool m_opaque; |
90 }; | 90 }; |
91 | 91 |
92 } // namespace blink | 92 } // namespace blink |
93 | 93 |
94 #endif // DOMFormData_h | 94 #endif // FormData_h |
OLD | NEW |