| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 if (index >= m_private->elements().size()) | 72 if (index >= m_private->elements().size()) |
| 73 return false; | 73 return false; |
| 74 | 74 |
| 75 const FormDataElement& element = m_private->elements()[index]; | 75 const FormDataElement& element = m_private->elements()[index]; |
| 76 | 76 |
| 77 result.data.reset(); | 77 result.data.reset(); |
| 78 result.filePath.reset(); | 78 result.filePath.reset(); |
| 79 result.fileStart = 0; | 79 result.fileStart = 0; |
| 80 result.fileLength = 0; | 80 result.fileLength = 0; |
| 81 result.modificationTime = invalidFileTime(); | 81 result.modificationTime = invalidFileTime(); |
| 82 result.url = KURL(); | |
| 83 result.blobURL = KURL(); | |
| 84 result.blobUUID.reset(); | 82 result.blobUUID.reset(); |
| 85 | 83 |
| 86 switch (element.m_type) { | 84 switch (element.m_type) { |
| 87 case FormDataElement::data: | 85 case FormDataElement::data: |
| 88 result.type = Element::TypeData; | 86 result.type = Element::TypeData; |
| 89 result.data.assign(element.m_data.data(), element.m_data.size()); | 87 result.data.assign(element.m_data.data(), element.m_data.size()); |
| 90 break; | 88 break; |
| 91 case FormDataElement::encodedFile: | 89 case FormDataElement::encodedFile: |
| 92 result.type = Element::TypeFile; | 90 result.type = Element::TypeFile; |
| 93 result.filePath = element.m_filename; | 91 result.filePath = element.m_filename; |
| 94 result.fileStart = element.m_fileStart; | 92 result.fileStart = element.m_fileStart; |
| 95 result.fileLength = element.m_fileLength; | 93 result.fileLength = element.m_fileLength; |
| 96 result.modificationTime = element.m_expectedFileModificationTime; | 94 result.modificationTime = element.m_expectedFileModificationTime; |
| 97 break; | 95 break; |
| 98 case FormDataElement::encodedBlob: | 96 case FormDataElement::encodedBlob: |
| 99 result.type = Element::TypeBlob; | 97 result.type = Element::TypeBlob; |
| 100 result.url = element.m_url; // DEPRECATED, should be able to remove afte
r https://codereview.chromium.org/23223003/ lands | 98 result.blobUUID = element.m_blobUUID; |
| 101 result.blobURL = element.m_url; // FIXME: deprecate this. | |
| 102 break; | 99 break; |
| 103 case FormDataElement::encodedURL: | 100 case FormDataElement::encodedFileSystemURL: |
| 104 result.type = Element::TypeFileSystemURL; | 101 result.type = Element::TypeFileSystemURL; |
| 105 result.url = element.m_url; // DEPRECATED | 102 result.fileSystemURL = element.m_fileSystemURL; |
| 106 result.fileSystemURL = element.m_url; | |
| 107 result.fileStart = element.m_fileStart; | 103 result.fileStart = element.m_fileStart; |
| 108 result.fileLength = element.m_fileLength; | 104 result.fileLength = element.m_fileLength; |
| 109 result.modificationTime = element.m_expectedFileModificationTime; | 105 result.modificationTime = element.m_expectedFileModificationTime; |
| 110 break; | 106 break; |
| 111 default: | 107 default: |
| 112 ASSERT_NOT_REACHED(); | 108 ASSERT_NOT_REACHED(); |
| 113 return false; | 109 return false; |
| 114 } | 110 } |
| 115 | 111 |
| 116 return true; | 112 return true; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 134 { | 130 { |
| 135 ensureMutable(); | 131 ensureMutable(); |
| 136 m_private->appendFileRange(filePath, fileStart, fileLength, modificationTime
); | 132 m_private->appendFileRange(filePath, fileStart, fileLength, modificationTime
); |
| 137 } | 133 } |
| 138 | 134 |
| 139 void WebHTTPBody::appendFileSystemURLRange(const WebURL& url, long long start, l
ong long length, double modificationTime) | 135 void WebHTTPBody::appendFileSystemURLRange(const WebURL& url, long long start, l
ong long length, double modificationTime) |
| 140 { | 136 { |
| 141 // Currently we only support filesystem URL. | 137 // Currently we only support filesystem URL. |
| 142 ASSERT(KURL(url).protocolIs("filesystem")); | 138 ASSERT(KURL(url).protocolIs("filesystem")); |
| 143 ensureMutable(); | 139 ensureMutable(); |
| 144 m_private->appendURLRange(url, start, length, modificationTime); | 140 m_private->appendFileSystemURLRange(url, start, length, modificationTime); |
| 145 } | 141 } |
| 146 | 142 |
| 147 void WebHTTPBody::appendURLRange(const WebURL& url, long long start, long long l
ength, double modificationTime) | 143 void WebHTTPBody::appendBlob(const WebString& uuid) |
| 148 { | 144 { |
| 149 appendFileSystemURLRange(url, start, length, modificationTime); | |
| 150 } | |
| 151 | |
| 152 void WebHTTPBody::appendBlob(const WebURL& blobURL) | |
| 153 { | |
| 154 ASSERT(KURL(blobURL).protocolIs("blob")); | |
| 155 ensureMutable(); | 145 ensureMutable(); |
| 156 m_private->appendBlob(blobURL); | 146 m_private->appendBlob(uuid, 0); |
| 157 } | 147 } |
| 158 | 148 |
| 159 long long WebHTTPBody::identifier() const | 149 long long WebHTTPBody::identifier() const |
| 160 { | 150 { |
| 161 ASSERT(!isNull()); | 151 ASSERT(!isNull()); |
| 162 return m_private->identifier(); | 152 return m_private->identifier(); |
| 163 } | 153 } |
| 164 | 154 |
| 165 void WebHTTPBody::setIdentifier(long long identifier) | 155 void WebHTTPBody::setIdentifier(long long identifier) |
| 166 { | 156 { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 } | 193 } |
| 204 | 194 |
| 205 void WebHTTPBody::ensureMutable() | 195 void WebHTTPBody::ensureMutable() |
| 206 { | 196 { |
| 207 ASSERT(!isNull()); | 197 ASSERT(!isNull()); |
| 208 if (!m_private->hasOneRef()) | 198 if (!m_private->hasOneRef()) |
| 209 assign(static_cast<WebHTTPBodyPrivate*>(m_private->copy().leakRef())); | 199 assign(static_cast<WebHTTPBodyPrivate*>(m_private->copy().leakRef())); |
| 210 } | 200 } |
| 211 | 201 |
| 212 } // namespace WebKit | 202 } // namespace WebKit |
| OLD | NEW |