| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 WebHTTPBody_h | 31 #ifndef WebHTTPBody_h |
| 32 #define WebHTTPBody_h | 32 #define WebHTTPBody_h |
| 33 | 33 |
| 34 #include "WebBlobData.h" |
| 34 #include "WebData.h" | 35 #include "WebData.h" |
| 35 #include "WebNonCopyable.h" | 36 #include "WebNonCopyable.h" |
| 36 #include "WebString.h" | 37 #include "WebString.h" |
| 37 #include "WebURL.h" | 38 #include "WebURL.h" |
| 38 | 39 |
| 39 #if BLINK_IMPLEMENTATION | 40 #if BLINK_IMPLEMENTATION |
| 40 namespace WebCore { class FormData; } | 41 namespace WebCore { class FormData; } |
| 41 namespace WTF { template <typename T> class PassRefPtr; } | 42 namespace WTF { template <typename T> class PassRefPtr; } |
| 42 #endif | 43 #endif |
| 43 | 44 |
| 44 namespace WebKit { | 45 namespace WebKit { |
| 45 | 46 |
| 46 class WebHTTPBodyPrivate; | 47 class WebHTTPBodyPrivate; |
| 47 | 48 |
| 48 class WebHTTPBody { | 49 class WebHTTPBody { |
| 49 public: | 50 public: |
| 50 struct Element { | 51 struct Element { |
| 51 enum Type { TypeData, TypeFile, TypeBlob, TypeFileSystemURL } type; | 52 enum Type { TypeData, TypeFile, TypeBlob, TypeFileSystemURL } type; |
| 52 WebData data; | 53 WebData data; |
| 53 WebString filePath; | 54 WebString filePath; |
| 54 long long fileStart; | 55 long long fileStart; |
| 55 long long fileLength; // -1 means to the end of the file. | 56 long long fileLength; // -1 means to the end of the file. |
| 56 double modificationTime; | 57 double modificationTime; |
| 57 WebURL fileSystemURL; | 58 WebURL fileSystemURL; |
| 58 | |
| 59 // DEPRECATED, use fileSystemURL | |
| 60 WebURL url; | |
| 61 | |
| 62 // FIXME: deprecate url and use uuid | |
| 63 WebURL blobURL; | |
| 64 WebString blobUUID; | 59 WebString blobUUID; |
| 65 }; | 60 }; |
| 66 | 61 |
| 67 ~WebHTTPBody() { reset(); } | 62 ~WebHTTPBody() { reset(); } |
| 68 | 63 |
| 69 WebHTTPBody() : m_private(0) { } | 64 WebHTTPBody() : m_private(0) { } |
| 70 WebHTTPBody(const WebHTTPBody& b) : m_private(0) { assign(b); } | 65 WebHTTPBody(const WebHTTPBody& b) : m_private(0) { assign(b); } |
| 71 WebHTTPBody& operator=(const WebHTTPBody& b) | 66 WebHTTPBody& operator=(const WebHTTPBody& b) |
| 72 { | 67 { |
| 73 assign(b); | 68 assign(b); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 85 | 80 |
| 86 // Sets the values of the element at the given index. Returns false if | 81 // Sets the values of the element at the given index. Returns false if |
| 87 // index is out of bounds. | 82 // index is out of bounds. |
| 88 BLINK_EXPORT bool elementAt(size_t index, Element&) const; | 83 BLINK_EXPORT bool elementAt(size_t index, Element&) const; |
| 89 | 84 |
| 90 // Append to the list of elements. | 85 // Append to the list of elements. |
| 91 BLINK_EXPORT void appendData(const WebData&); | 86 BLINK_EXPORT void appendData(const WebData&); |
| 92 BLINK_EXPORT void appendFile(const WebString&); | 87 BLINK_EXPORT void appendFile(const WebString&); |
| 93 // Passing -1 to fileLength means to the end of the file. | 88 // Passing -1 to fileLength means to the end of the file. |
| 94 BLINK_EXPORT void appendFileRange(const WebString&, long long fileStart, lon
g long fileLength, double modificationTime); | 89 BLINK_EXPORT void appendFileRange(const WebString&, long long fileStart, lon
g long fileLength, double modificationTime); |
| 95 BLINK_EXPORT void appendBlob(const WebURL&); // FIXME: deprecate this | 90 BLINK_EXPORT void appendBlob(const WebString& uuid); |
| 96 | 91 |
| 97 // Append a resource which is identified by the FileSystem URL. | 92 // Append a resource which is identified by the FileSystem URL. |
| 98 BLINK_EXPORT void appendFileSystemURLRange(const WebURL&, long long start, l
ong long length, double modificationTime); | 93 BLINK_EXPORT void appendFileSystemURLRange(const WebURL&, long long start, l
ong long length, double modificationTime); |
| 99 BLINK_EXPORT void appendURLRange(const WebURL&, long long start, long long l
ength, double modificationTime); // DEPRECATED | |
| 100 | 94 |
| 101 // Identifies a particular form submission instance. A value of 0 is | 95 // Identifies a particular form submission instance. A value of 0 is |
| 102 // used to indicate an unspecified identifier. | 96 // used to indicate an unspecified identifier. |
| 103 BLINK_EXPORT long long identifier() const; | 97 BLINK_EXPORT long long identifier() const; |
| 104 BLINK_EXPORT void setIdentifier(long long); | 98 BLINK_EXPORT void setIdentifier(long long); |
| 105 | 99 |
| 106 BLINK_EXPORT bool containsPasswordData() const; | 100 BLINK_EXPORT bool containsPasswordData() const; |
| 107 BLINK_EXPORT void setContainsPasswordData(bool); | 101 BLINK_EXPORT void setContainsPasswordData(bool); |
| 108 | 102 |
| 109 #if BLINK_IMPLEMENTATION | 103 #if BLINK_IMPLEMENTATION |
| 110 WebHTTPBody(const WTF::PassRefPtr<WebCore::FormData>&); | 104 WebHTTPBody(const WTF::PassRefPtr<WebCore::FormData>&); |
| 111 WebHTTPBody& operator=(const WTF::PassRefPtr<WebCore::FormData>&); | 105 WebHTTPBody& operator=(const WTF::PassRefPtr<WebCore::FormData>&); |
| 112 operator WTF::PassRefPtr<WebCore::FormData>() const; | 106 operator WTF::PassRefPtr<WebCore::FormData>() const; |
| 113 #endif | 107 #endif |
| 114 | 108 |
| 115 private: | 109 private: |
| 116 void assign(WebHTTPBodyPrivate*); | 110 void assign(WebHTTPBodyPrivate*); |
| 117 void ensureMutable(); | 111 void ensureMutable(); |
| 118 WebHTTPBodyPrivate* m_private; | 112 WebHTTPBodyPrivate* m_private; |
| 119 }; | 113 }; |
| 120 | 114 |
| 121 } // namespace WebKit | 115 } // namespace WebKit |
| 122 | 116 |
| 123 #endif | 117 #endif |
| OLD | NEW |