OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 FormDataEncoder::beginMultiPartHeader(header, formData->boundary().d
ata(), item.key()); | 86 FormDataEncoder::beginMultiPartHeader(header, formData->boundary().d
ata(), item.key()); |
87 | 87 |
88 // If the current type is blob, then we also need to include the fil
ename | 88 // If the current type is blob, then we also need to include the fil
ename |
89 if (item.blob()) { | 89 if (item.blob()) { |
90 String name; | 90 String name; |
91 if (item.blob()->isFile()) { | 91 if (item.blob()->isFile()) { |
92 File* file = toFile(item.blob()); | 92 File* file = toFile(item.blob()); |
93 // For file blob, use the filename (or relative path if it i
s present) as the name. | 93 // For file blob, use the filename (or relative path if it i
s present) as the name. |
94 name = file->webkitRelativePath().isEmpty() ? file->name() :
file->webkitRelativePath(); | 94 name = file->webkitRelativePath().isEmpty() ? file->name() :
file->webkitRelativePath(); |
95 | 95 |
96 // If a filename is passed in DOMFormData.append(), use it | 96 // If a filename is passed in FormData.append(), use it |
97 // instead of the file blob's name. | 97 // instead of the file blob's name. |
98 if (!item.filename().isNull()) | 98 if (!item.filename().isNull()) |
99 name = item.filename(); | 99 name = item.filename(); |
100 } else { | 100 } else { |
101 // For non-file blob, use the filename if it is passed in | 101 // For non-file blob, use the filename if it is passed in |
102 // DOMFormData.append(). | 102 // FormData.append(). |
103 if (!item.filename().isNull()) | 103 if (!item.filename().isNull()) |
104 name = item.filename(); | 104 name = item.filename(); |
105 else | 105 else |
106 name = "blob"; | 106 name = "blob"; |
107 } | 107 } |
108 | 108 |
109 // We have to include the filename=".." part in the header, even
if the filename is empty | 109 // We have to include the filename=".." part in the header, even
if the filename is empty |
110 FormDataEncoder::addFilenameToMultiPartHeader(header, encoding,
name); | 110 FormDataEncoder::addFilenameToMultiPartHeader(header, encoding,
name); |
111 | 111 |
112 // Add the content type if available, or "application/octet-stre
am" otherwise (RFC 1867). | 112 // Add the content type if available, or "application/octet-stre
am" otherwise (RFC 1867). |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 { | 158 { |
159 visitor->trace(m_items); | 159 visitor->trace(m_items); |
160 } | 160 } |
161 | 161 |
162 DEFINE_TRACE(FormDataList::Item) | 162 DEFINE_TRACE(FormDataList::Item) |
163 { | 163 { |
164 visitor->trace(m_blob); | 164 visitor->trace(m_blob); |
165 } | 165 } |
166 | 166 |
167 } // namespace blink | 167 } // namespace blink |
OLD | NEW |