| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 class FormSubmission : public RefCounted<FormSubmission> { | 49 class FormSubmission : public RefCounted<FormSubmission> { |
| 50 public: | 50 public: |
| 51 enum Method { GetMethod, PostMethod, DialogMethod }; | 51 enum Method { GetMethod, PostMethod, DialogMethod }; |
| 52 | 52 |
| 53 class Attributes { | 53 class Attributes { |
| 54 WTF_MAKE_NONCOPYABLE(Attributes); | 54 WTF_MAKE_NONCOPYABLE(Attributes); |
| 55 public: | 55 public: |
| 56 Attributes() | 56 Attributes() |
| 57 : m_method(GetMethod) | 57 : m_method(GetMethod) |
| 58 , m_isMultiPartForm(false) | 58 , m_isMultiPartForm(false) |
| 59 , m_encodingType("application/x-www-form-urlencoded") | 59 , m_encodingType("application/x-www-form-urlencoded", AtomicString::
ConstructFromLiteral) |
| 60 { | 60 { |
| 61 } | 61 } |
| 62 | 62 |
| 63 Method method() const { return m_method; } | 63 Method method() const { return m_method; } |
| 64 static Method parseMethodType(const String&); | 64 static Method parseMethodType(const String&); |
| 65 void updateMethodType(const String&); | 65 void updateMethodType(const String&); |
| 66 static String methodString(Method); | 66 static String methodString(Method); |
| 67 | 67 |
| 68 const String& action() const { return m_action; } | 68 const String& action() const { return m_action; } |
| 69 void parseAction(const String&); | 69 void parseAction(const String&); |
| 70 | 70 |
| 71 const AtomicString& target() const { return m_target; } | 71 const AtomicString& target() const { return m_target; } |
| 72 void setTarget(const AtomicString& target) { m_target = target; } | 72 void setTarget(const AtomicString& target) { m_target = target; } |
| 73 | 73 |
| 74 const String& encodingType() const { return m_encodingType; } | 74 const AtomicString& encodingType() const { return m_encodingType; } |
| 75 static String parseEncodingType(const String&); | 75 static AtomicString parseEncodingType(const String&); |
| 76 void updateEncodingType(const String&); | 76 void updateEncodingType(const String&); |
| 77 bool isMultiPartForm() const { return m_isMultiPartForm; } | 77 bool isMultiPartForm() const { return m_isMultiPartForm; } |
| 78 | 78 |
| 79 const String& acceptCharset() const { return m_acceptCharset; } | 79 const String& acceptCharset() const { return m_acceptCharset; } |
| 80 void setAcceptCharset(const String& value) { m_acceptCharset = value; } | 80 void setAcceptCharset(const String& value) { m_acceptCharset = value; } |
| 81 | 81 |
| 82 void copyFrom(const Attributes&); | 82 void copyFrom(const Attributes&); |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 Method m_method; | 85 Method m_method; |
| 86 bool m_isMultiPartForm; | 86 bool m_isMultiPartForm; |
| 87 | 87 |
| 88 String m_action; | 88 String m_action; |
| 89 AtomicString m_target; | 89 AtomicString m_target; |
| 90 String m_encodingType; | 90 AtomicString m_encodingType; |
| 91 String m_acceptCharset; | 91 String m_acceptCharset; |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 static PassRefPtr<FormSubmission> create(HTMLFormElement*, const Attributes&
, PassRefPtr<Event> event, FormSubmissionTrigger); | 94 static PassRefPtr<FormSubmission> create(HTMLFormElement*, const Attributes&
, PassRefPtr<Event> event, FormSubmissionTrigger); |
| 95 | 95 |
| 96 void populateFrameLoadRequest(FrameLoadRequest&); | 96 void populateFrameLoadRequest(FrameLoadRequest&); |
| 97 | 97 |
| 98 KURL requestURL() const; | 98 KURL requestURL() const; |
| 99 | 99 |
| 100 Method method() const { return m_method; } | 100 Method method() const { return m_method; } |
| 101 const KURL& action() const { return m_action; } | 101 const KURL& action() const { return m_action; } |
| 102 const AtomicString& target() const { return m_target; } | 102 const AtomicString& target() const { return m_target; } |
| 103 void clearTarget() { m_target = nullAtom; } | 103 void clearTarget() { m_target = nullAtom; } |
| 104 const String& contentType() const { return m_contentType; } | 104 const AtomicString& contentType() const { return m_contentType; } |
| 105 FormState* state() const { return m_formState.get(); } | 105 FormState* state() const { return m_formState.get(); } |
| 106 FormData* data() const { return m_formData.get(); } | 106 FormData* data() const { return m_formData.get(); } |
| 107 const String boundary() const { return m_boundary; } | 107 const String boundary() const { return m_boundary; } |
| 108 Event* event() const { return m_event.get(); } | 108 Event* event() const { return m_event.get(); } |
| 109 | 109 |
| 110 const String& referrer() const { return m_referrer; } | 110 const String& referrer() const { return m_referrer; } |
| 111 void setReferrer(const String& referrer) { m_referrer = referrer; } | 111 void setReferrer(const String& referrer) { m_referrer = referrer; } |
| 112 const String& origin() const { return m_origin; } | 112 const String& origin() const { return m_origin; } |
| 113 void setOrigin(const String& origin) { m_origin = origin; } | 113 void setOrigin(const String& origin) { m_origin = origin; } |
| 114 | 114 |
| 115 const String& result() const { return m_result; } | 115 const String& result() const { return m_result; } |
| 116 | 116 |
| 117 private: | 117 private: |
| 118 FormSubmission(Method, const KURL& action, const AtomicString& target, const
String& contentType, PassRefPtr<FormState>, PassRefPtr<FormData>, const String&
boundary, PassRefPtr<Event>); | 118 FormSubmission(Method, const KURL& action, const AtomicString& target, const
AtomicString& contentType, PassRefPtr<FormState>, PassRefPtr<FormData>, const S
tring& boundary, PassRefPtr<Event>); |
| 119 // FormSubmission for DialogMethod | 119 // FormSubmission for DialogMethod |
| 120 FormSubmission(const String& result); | 120 FormSubmission(const String& result); |
| 121 | 121 |
| 122 // FIXME: Hold an instance of Attributes instead of individual members. | 122 // FIXME: Hold an instance of Attributes instead of individual members. |
| 123 Method m_method; | 123 Method m_method; |
| 124 KURL m_action; | 124 KURL m_action; |
| 125 AtomicString m_target; | 125 AtomicString m_target; |
| 126 String m_contentType; | 126 AtomicString m_contentType; |
| 127 RefPtr<FormState> m_formState; | 127 RefPtr<FormState> m_formState; |
| 128 RefPtr<FormData> m_formData; | 128 RefPtr<FormData> m_formData; |
| 129 String m_boundary; | 129 String m_boundary; |
| 130 RefPtr<Event> m_event; | 130 RefPtr<Event> m_event; |
| 131 String m_referrer; | 131 String m_referrer; |
| 132 String m_origin; | 132 String m_origin; |
| 133 String m_result; | 133 String m_result; |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 } | 136 } |
| 137 | 137 |
| 138 #endif // FormSubmission_h | 138 #endif // FormSubmission_h |
| OLD | NEW |