Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1345)

Side by Side Diff: WebCore/platform/network/FormData.h

Issue 11192017: ********** WebCore blob hacking (Closed) Base URL: http://svn.webkit.org/repository/webkit/trunk/Source/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 */ 18 */
19 19
20 #ifndef FormData_h 20 #ifndef FormData_h
21 #define FormData_h 21 #define FormData_h
22 22
23 #include "BlobData.h"
23 #include "KURL.h" 24 #include "KURL.h"
24 #include <wtf/Forward.h> 25 #include <wtf/Forward.h>
25 #include <wtf/RefCounted.h> 26 #include <wtf/RefCounted.h>
26 #include <wtf/Vector.h> 27 #include <wtf/Vector.h>
27 #include <wtf/text/WTFString.h> 28 #include <wtf/text/WTFString.h>
28 29
29 namespace WebCore { 30 namespace WebCore {
30 31
32 class BlobDataHandle;
31 class Document; 33 class Document;
32 class FormDataList; 34 class FormDataList;
33 class TextEncoding; 35 class TextEncoding;
34 36
35 class FormDataElement { 37 class FormDataElement {
36 public: 38 public:
37 FormDataElement() : m_type(data) { } 39 FormDataElement() : m_type(data) { }
38 explicit FormDataElement(const Vector<char>& array) : m_type(data), m_data(a rray) { } 40 explicit FormDataElement(const Vector<char>& array) : m_type(data), m_data(a rray) { }
39 41
40 #if ENABLE(BLOB) 42 #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) { } 43 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) { } 44 explicit FormDataElement(PassRefPtr<BlobDataHandle> blobDataHandle) : m_type (encodedBlob), m_blobDataHandle(blobDataHandle) { }
43 #else 45 #else
44 FormDataElement(const String& filename, bool shouldGenerateFile) : m_type(en codedFile), m_filename(filename), m_shouldGenerateFile(shouldGenerateFile) { } 46 FormDataElement(const String& filename, bool shouldGenerateFile) : m_type(en codedFile), m_filename(filename), m_shouldGenerateFile(shouldGenerateFile) { }
45 #endif 47 #endif
46 #if ENABLE(FILE_SYSTEM) 48 #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) { } 49 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 50 #endif
49 51
50 enum Type { 52 enum Type {
51 data, 53 data,
52 encodedFile 54 encodedFile
53 #if ENABLE(BLOB) 55 #if ENABLE(BLOB)
54 , encodedBlob 56 , encodedBlob
55 #endif 57 #endif
56 #if ENABLE(FILE_SYSTEM) 58 #if ENABLE(FILE_SYSTEM)
57 , encodedURL 59 , encodedURL
58 #endif 60 #endif
59 } m_type; 61 } m_type;
60 Vector<char> m_data; 62 Vector<char> m_data;
61 String m_filename; 63 String m_filename;
62 #if ENABLE(BLOB) 64 #if ENABLE(BLOB)
63 KURL m_url; // For Blob or URL. 65 RefPtr<BlobDataHandle> m_blobDataHandle;
66 KURL m_url; // For filesystem URL type.
64 long long m_fileStart; 67 long long m_fileStart;
65 long long m_fileLength; 68 long long m_fileLength;
66 double m_expectedFileModificationTime; 69 double m_expectedFileModificationTime;
67 #endif 70 #endif
68 String m_generatedFilename; 71 String m_generatedFilename;
69 bool m_shouldGenerateFile; 72 bool m_shouldGenerateFile;
70 }; 73 };
71 74
72 inline bool operator==(const FormDataElement& a, const FormDataElement& b) 75 inline bool operator==(const FormDataElement& a, const FormDataElement& b)
73 { 76 {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 PassRefPtr<FormData> deepCopy() const; 120 PassRefPtr<FormData> deepCopy() const;
118 ~FormData(); 121 ~FormData();
119 122
120 void encodeForBackForward(Encoder&) const; 123 void encodeForBackForward(Encoder&) const;
121 static PassRefPtr<FormData> decodeForBackForward(Decoder&); 124 static PassRefPtr<FormData> decodeForBackForward(Decoder&);
122 125
123 void appendData(const void* data, size_t); 126 void appendData(const void* data, size_t);
124 void appendFile(const String& filePath, bool shouldGenerateFile = false); 127 void appendFile(const String& filePath, bool shouldGenerateFile = false);
125 #if ENABLE(BLOB) 128 #if ENABLE(BLOB)
126 void appendFileRange(const String& filename, long long start, long long leng th, double expectedModificationTime, bool shouldGenerateFile = false); 129 void appendFileRange(const String& filename, long long start, long long leng th, double expectedModificationTime, bool shouldGenerateFile = false);
127 void appendBlob(const KURL& blobURL); 130 void appendBlob(PassRefPtr<BlobDataHandle>);
128 #endif 131 #endif
129 #if ENABLE(FILE_SYSTEM) 132 #if ENABLE(FILE_SYSTEM)
130 void appendURL(const KURL&); 133 void appendURL(const KURL&);
131 void appendURLRange(const KURL&, long long start, long long length, double e xpectedModificationTime); 134 void appendURLRange(const KURL&, long long start, long long length, double e xpectedModificationTime);
132 #endif 135 #endif
133 136
134 void flatten(Vector<char>&) const; // omits files 137 void flatten(Vector<char>&) const; // omits files
135 String flattenToString() const; // omits files 138 String flattenToString() const; // omits files
136 139
137 bool isEmpty() const { return m_elements.isEmpty(); } 140 bool isEmpty() const { return m_elements.isEmpty(); }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 187 }
185 188
186 inline bool operator!=(const FormData& a, const FormData& b) 189 inline bool operator!=(const FormData& a, const FormData& b)
187 { 190 {
188 return !(a == b); 191 return !(a == b);
189 } 192 }
190 193
191 } // namespace WebCore 194 } // namespace WebCore
192 195
193 #endif 196 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698