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 13 matching lines...) Expand all Loading... |
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 DOMFormData_h |
32 #define DOMFormData_h | 32 #define DOMFormData_h |
33 | 33 |
| 34 #include "bindings/core/v8/ScriptState.h" |
| 35 #include "bindings/core/v8/UnionTypesCore.h" |
| 36 #include "core/dom/Iterable.h" |
34 #include "core/html/FormDataList.h" | 37 #include "core/html/FormDataList.h" |
35 #include "platform/heap/Handle.h" | 38 #include "platform/heap/Handle.h" |
36 #include "wtf/Forward.h" | 39 #include "wtf/Forward.h" |
37 #include "wtf/PassRefPtr.h" | 40 #include "wtf/PassRefPtr.h" |
38 #include "wtf/RefCounted.h" | 41 #include "wtf/RefCounted.h" |
39 | 42 |
40 namespace WTF{ | 43 namespace WTF{ |
41 class TextEncoding; | 44 class TextEncoding; |
42 } | 45 } |
43 | 46 |
44 namespace blink { | 47 namespace blink { |
45 | 48 |
46 class Blob; | 49 class Blob; |
47 class HTMLFormElement; | 50 class HTMLFormElement; |
48 | 51 |
49 class DOMFormData final : public FormDataList, public ScriptWrappable { | 52 // Typedef from FormData.idl: |
| 53 typedef FileOrUSVString FormDataEntryValue; |
| 54 |
| 55 class DOMFormData final : public FormDataList, public ScriptWrappable, public Pa
irIterable<String, FormDataEntryValue> { |
50 DEFINE_WRAPPERTYPEINFO(); | 56 DEFINE_WRAPPERTYPEINFO(); |
| 57 |
51 public: | 58 public: |
52 static PassRefPtrWillBeRawPtr<DOMFormData> create(HTMLFormElement* form = 0) | 59 static PassRefPtrWillBeRawPtr<DOMFormData> create(HTMLFormElement* form = 0) |
53 { | 60 { |
54 return adoptRefWillBeNoop(new DOMFormData(form)); | 61 return adoptRefWillBeNoop(new DOMFormData(form)); |
55 } | 62 } |
56 | 63 |
57 static PassRefPtrWillBeRawPtr<DOMFormData> create(const WTF::TextEncoding& e
ncoding) | 64 static PassRefPtrWillBeRawPtr<DOMFormData> create(const WTF::TextEncoding& e
ncoding) |
58 { | 65 { |
59 return adoptRefWillBeNoop(new DOMFormData(encoding)); | 66 return adoptRefWillBeNoop(new DOMFormData(encoding)); |
60 } | 67 } |
61 | 68 |
| 69 // FormData interface. |
62 void append(const String& name, const String& value); | 70 void append(const String& name, const String& value); |
63 void append(const String& name, Blob*, const String& filename = String()); | 71 void append(const String& name, Blob*, const String& filename = String()); |
| 72 void get(const String& name, FormDataEntryValue& result); |
| 73 Vector<FormDataEntryValue> getAll(const String& name); |
| 74 void set(const String& name, const String& value); |
| 75 void set(const String& name, Blob*, const String& filename = String()); |
64 | 76 |
65 private: | 77 private: |
66 explicit DOMFormData(const WTF::TextEncoding&); | 78 explicit DOMFormData(const WTF::TextEncoding&); |
67 explicit DOMFormData(HTMLFormElement*); | 79 explicit DOMFormData(HTMLFormElement*); |
| 80 |
| 81 IterationSource* startIteration(ScriptState*, ExceptionState&) override; |
68 }; | 82 }; |
69 | 83 |
70 } // namespace blink | 84 } // namespace blink |
71 | 85 |
72 #endif // DOMFormData_h | 86 #endif // DOMFormData_h |
OLD | NEW |