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