| 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" |
| 34 #include "core/html/FormDataList.h" | 35 #include "core/html/FormDataList.h" |
| 35 #include "platform/heap/Handle.h" | 36 #include "platform/heap/Handle.h" |
| 36 #include "wtf/Forward.h" | 37 #include "wtf/Forward.h" |
| 37 #include "wtf/PassRefPtr.h" | 38 #include "wtf/PassRefPtr.h" |
| 38 #include "wtf/RefCounted.h" | 39 #include "wtf/RefCounted.h" |
| 39 | 40 |
| 40 namespace WTF{ | 41 namespace WTF{ |
| 41 class TextEncoding; | 42 class TextEncoding; |
| 42 } | 43 } |
| 43 | 44 |
| 44 namespace blink { | 45 namespace blink { |
| 45 | 46 |
| 46 class Blob; | 47 class Blob; |
| 47 class HTMLFormElement; | 48 class HTMLFormElement; |
| 49 class Iterator; |
| 48 | 50 |
| 49 class DOMFormData : public RefCountedWillBeGarbageCollectedFinalized<DOMFormData
>, public FormDataList, public ScriptWrappable { | 51 class DOMFormData : public RefCountedWillBeGarbageCollectedFinalized<DOMFormData
>, public FormDataList, public ScriptWrappable { |
| 50 DEFINE_WRAPPERTYPEINFO(); | 52 DEFINE_WRAPPERTYPEINFO(); |
| 53 |
| 51 public: | 54 public: |
| 55 |
| 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 |
| 67 // FormData interface. |
| 62 void append(const String& name, const String& value); | 68 void append(const String& name, const String& value); |
| 63 void append(const String& name, Blob*, const String& filename = String()); | 69 void append(const String& name, Blob*, const String& filename = String()); |
| 70 void remove(const String& name); |
| 71 ScriptValue get(ScriptState*, const String& name); |
| 72 Vector<ScriptValue> getAll(ScriptState*, const String& name); |
| 73 bool has(const String& name); |
| 74 void set(const String& name, const String& value); |
| 75 void set(const String& name, Blob*, const String& filename = String()); |
| 76 |
| 77 // MapLikeIterable |
| 78 Iterator* iterator(ScriptState*, ExceptionState&) { return entries(); } |
| 79 Iterator* entries(); |
| 80 Iterator* keys(); |
| 81 Iterator* values(); |
| 64 | 82 |
| 65 private: | 83 private: |
| 66 explicit DOMFormData(const WTF::TextEncoding&); | 84 explicit DOMFormData(const WTF::TextEncoding&); |
| 67 explicit DOMFormData(HTMLFormElement*); | 85 explicit DOMFormData(HTMLFormElement*); |
| 68 }; | 86 }; |
| 69 | 87 |
| 70 } // namespace blink | 88 } // namespace blink |
| 71 | 89 |
| 72 #endif // DOMFormData_h | 90 #endif // DOMFormData_h |
| OLD | NEW |