Chromium Code Reviews| 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; |
| 51 class Iterator; | |
|
sof
2015/01/22 07:33:40
Not used in what follows. IterationSource is, but
jsbell
2015/01/22 19:05:38
Done.
| |
| 48 | 52 |
| 49 class DOMFormData final : public FormDataList, public ScriptWrappable { | 53 // Typedef from FormData.idl: |
| 54 typedef FileOrUSVString FormDataEntryValue; | |
| 55 | |
| 56 class DOMFormData final : public FormDataList, public ScriptWrappable, public Pa irIterable<String, FormDataEntryValue> { | |
| 50 DEFINE_WRAPPERTYPEINFO(); | 57 DEFINE_WRAPPERTYPEINFO(); |
| 58 | |
| 51 public: | 59 public: |
| 52 static PassRefPtrWillBeRawPtr<DOMFormData> create(HTMLFormElement* form = 0) | 60 static PassRefPtrWillBeRawPtr<DOMFormData> create(HTMLFormElement* form = 0) |
| 53 { | 61 { |
| 54 return adoptRefWillBeNoop(new DOMFormData(form)); | 62 return adoptRefWillBeNoop(new DOMFormData(form)); |
| 55 } | 63 } |
| 56 | 64 |
| 57 static PassRefPtrWillBeRawPtr<DOMFormData> create(const WTF::TextEncoding& e ncoding) | 65 static PassRefPtrWillBeRawPtr<DOMFormData> create(const WTF::TextEncoding& e ncoding) |
| 58 { | 66 { |
| 59 return adoptRefWillBeNoop(new DOMFormData(encoding)); | 67 return adoptRefWillBeNoop(new DOMFormData(encoding)); |
| 60 } | 68 } |
| 61 | 69 |
| 70 // FormData interface. | |
| 62 void append(const String& name, const String& value); | 71 void append(const String& name, const String& value); |
| 63 void append(const String& name, Blob*, const String& filename = String()); | 72 void append(const String& name, Blob*, const String& filename = String()); |
| 73 void get(const String& name, FormDataEntryValue& result); | |
| 74 Vector<FormDataEntryValue> getAll(const String& name); | |
| 75 void set(const String& name, const String& value); | |
| 76 void set(const String& name, Blob*, const String& filename = String()); | |
| 64 | 77 |
| 65 private: | 78 private: |
| 66 explicit DOMFormData(const WTF::TextEncoding&); | 79 explicit DOMFormData(const WTF::TextEncoding&); |
| 67 explicit DOMFormData(HTMLFormElement*); | 80 explicit DOMFormData(HTMLFormElement*); |
| 81 | |
| 82 IterationSource* startIteration(ScriptState*, ExceptionState&) override; | |
| 68 }; | 83 }; |
| 69 | 84 |
| 70 } // namespace blink | 85 } // namespace blink |
| 71 | 86 |
| 72 #endif // DOMFormData_h | 87 #endif // DOMFormData_h |
| OLD | NEW |