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