| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2008, 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 public: | 36 public: |
| 37 FormDataElement() : m_type(data) { } | 37 FormDataElement() : m_type(data) { } |
| 38 explicit FormDataElement(const Vector<char>& array) : m_type(data), m_data(a
rray) { } | 38 explicit FormDataElement(const Vector<char>& array) : m_type(data), m_data(a
rray) { } |
| 39 | 39 |
| 40 #if ENABLE(BLOB) | 40 #if ENABLE(BLOB) |
| 41 FormDataElement(const String& filename, long long fileStart, long long fileL
ength, double expectedFileModificationTime, bool shouldGenerateFile) : m_type(en
codedFile), m_filename(filename), m_fileStart(fileStart), m_fileLength(fileLengt
h), m_expectedFileModificationTime(expectedFileModificationTime), m_shouldGenera
teFile(shouldGenerateFile) { } | 41 FormDataElement(const String& filename, long long fileStart, long long fileL
ength, double expectedFileModificationTime, bool shouldGenerateFile) : m_type(en
codedFile), m_filename(filename), m_fileStart(fileStart), m_fileLength(fileLengt
h), m_expectedFileModificationTime(expectedFileModificationTime), m_shouldGenera
teFile(shouldGenerateFile) { } |
| 42 explicit FormDataElement(const KURL& blobURL) : m_type(encodedBlob), m_url(b
lobURL) { } | 42 explicit FormDataElement(const KURL& blobURL) : m_type(encodedBlob), m_url(b
lobURL) { } |
| 43 #else | 43 #else |
| 44 FormDataElement(const String& filename, bool shouldGenerateFile) : m_type(en
codedFile), m_filename(filename), m_shouldGenerateFile(shouldGenerateFile) { } | 44 FormDataElement(const String& filename, bool shouldGenerateFile) : m_type(en
codedFile), m_filename(filename), m_shouldGenerateFile(shouldGenerateFile) { } |
| 45 #endif | 45 #endif |
| 46 #if ENABLE(FILE_SYSTEM) | |
| 47 FormDataElement(const KURL& url, long long start, long long length, double e
xpectedFileModificationTime) : m_type(encodedURL), m_url(url), m_fileStart(start
), m_fileLength(length), m_expectedFileModificationTime(expectedFileModification
Time), m_shouldGenerateFile(false) { } | 46 FormDataElement(const KURL& url, long long start, long long length, double e
xpectedFileModificationTime) : m_type(encodedURL), m_url(url), m_fileStart(start
), m_fileLength(length), m_expectedFileModificationTime(expectedFileModification
Time), m_shouldGenerateFile(false) { } |
| 48 #endif | |
| 49 | 47 |
| 50 void reportMemoryUsage(MemoryObjectInfo*) const; | 48 void reportMemoryUsage(MemoryObjectInfo*) const; |
| 51 | 49 |
| 52 enum Type { | 50 enum Type { |
| 53 data, | 51 data, |
| 54 encodedFile | 52 encodedFile |
| 55 #if ENABLE(BLOB) | 53 #if ENABLE(BLOB) |
| 56 , encodedBlob | 54 , encodedBlob |
| 57 #endif | 55 #endif |
| 58 #if ENABLE(FILE_SYSTEM) | |
| 59 , encodedURL | 56 , encodedURL |
| 60 #endif | |
| 61 } m_type; | 57 } m_type; |
| 62 Vector<char> m_data; | 58 Vector<char> m_data; |
| 63 String m_filename; | 59 String m_filename; |
| 64 #if ENABLE(BLOB) | 60 #if ENABLE(BLOB) |
| 65 KURL m_url; // For Blob or URL. | 61 KURL m_url; // For Blob or URL. |
| 66 long long m_fileStart; | 62 long long m_fileStart; |
| 67 long long m_fileLength; | 63 long long m_fileLength; |
| 68 double m_expectedFileModificationTime; | 64 double m_expectedFileModificationTime; |
| 69 #endif | 65 #endif |
| 70 String m_generatedFilename; | 66 String m_generatedFilename; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 81 if (a.m_type == FormDataElement::data) | 77 if (a.m_type == FormDataElement::data) |
| 82 return a.m_data == b.m_data; | 78 return a.m_data == b.m_data; |
| 83 if (a.m_type == FormDataElement::encodedFile) | 79 if (a.m_type == FormDataElement::encodedFile) |
| 84 #if ENABLE(BLOB) | 80 #if ENABLE(BLOB) |
| 85 return a.m_filename == b.m_filename && a.m_fileStart == b.m_fileStart &&
a.m_fileLength == b.m_fileLength && a.m_expectedFileModificationTime == b.m_exp
ectedFileModificationTime; | 81 return a.m_filename == b.m_filename && a.m_fileStart == b.m_fileStart &&
a.m_fileLength == b.m_fileLength && a.m_expectedFileModificationTime == b.m_exp
ectedFileModificationTime; |
| 86 if (a.m_type == FormDataElement::encodedBlob) | 82 if (a.m_type == FormDataElement::encodedBlob) |
| 87 return a.m_url == b.m_url; | 83 return a.m_url == b.m_url; |
| 88 #else | 84 #else |
| 89 return a.m_filename == b.m_filename; | 85 return a.m_filename == b.m_filename; |
| 90 #endif | 86 #endif |
| 91 #if ENABLE(FILE_SYSTEM) | |
| 92 if (a.m_type == FormDataElement::encodedURL) | 87 if (a.m_type == FormDataElement::encodedURL) |
| 93 return a.m_url == b.m_url; | 88 return a.m_url == b.m_url; |
| 94 #endif | |
| 95 | 89 |
| 96 return true; | 90 return true; |
| 97 } | 91 } |
| 98 | 92 |
| 99 inline bool operator!=(const FormDataElement& a, const FormDataElement& b) | 93 inline bool operator!=(const FormDataElement& a, const FormDataElement& b) |
| 100 { | 94 { |
| 101 return !(a == b); | 95 return !(a == b); |
| 102 } | 96 } |
| 103 | 97 |
| 104 class FormData : public RefCounted<FormData> { | 98 class FormData : public RefCounted<FormData> { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 121 | 115 |
| 122 void encode(Encoder&) const; | 116 void encode(Encoder&) const; |
| 123 static PassRefPtr<FormData> decode(Decoder&); | 117 static PassRefPtr<FormData> decode(Decoder&); |
| 124 | 118 |
| 125 void appendData(const void* data, size_t); | 119 void appendData(const void* data, size_t); |
| 126 void appendFile(const String& filePath, bool shouldGenerateFile = false); | 120 void appendFile(const String& filePath, bool shouldGenerateFile = false); |
| 127 #if ENABLE(BLOB) | 121 #if ENABLE(BLOB) |
| 128 void appendFileRange(const String& filename, long long start, long long leng
th, double expectedModificationTime, bool shouldGenerateFile = false); | 122 void appendFileRange(const String& filename, long long start, long long leng
th, double expectedModificationTime, bool shouldGenerateFile = false); |
| 129 void appendBlob(const KURL& blobURL); | 123 void appendBlob(const KURL& blobURL); |
| 130 #endif | 124 #endif |
| 131 #if ENABLE(FILE_SYSTEM) | |
| 132 void appendURL(const KURL&); | 125 void appendURL(const KURL&); |
| 133 void appendURLRange(const KURL&, long long start, long long length, double e
xpectedModificationTime); | 126 void appendURLRange(const KURL&, long long start, long long length, double e
xpectedModificationTime); |
| 134 #endif | |
| 135 | 127 |
| 136 void flatten(Vector<char>&) const; // omits files | 128 void flatten(Vector<char>&) const; // omits files |
| 137 String flattenToString() const; // omits files | 129 String flattenToString() const; // omits files |
| 138 | 130 |
| 139 #if ENABLE(BLOB) | 131 #if ENABLE(BLOB) |
| 140 // Resolve all blob references so we only have file and data. | 132 // Resolve all blob references so we only have file and data. |
| 141 // If the FormData has no blob references to resolve, this is returned. | 133 // If the FormData has no blob references to resolve, this is returned. |
| 142 PassRefPtr<FormData> resolveBlobReferences(); | 134 PassRefPtr<FormData> resolveBlobReferences(); |
| 143 #endif | 135 #endif |
| 144 | 136 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 184 } |
| 193 | 185 |
| 194 inline bool operator!=(const FormData& a, const FormData& b) | 186 inline bool operator!=(const FormData& a, const FormData& b) |
| 195 { | 187 { |
| 196 return !(a == b); | 188 return !(a == b); |
| 197 } | 189 } |
| 198 | 190 |
| 199 } // namespace WebCore | 191 } // namespace WebCore |
| 200 | 192 |
| 201 #endif | 193 #endif |
| OLD | NEW |