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