| 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(); | 82 result.fileSystemURL = KURL(); |
| 83 result.blobURL = KURL(); | 83 result.blobUUID = String(); |
| 84 | 84 |
| 85 switch (element.m_type) { | 85 switch (element.m_type) { |
| 86 case FormDataElement::data: | 86 case FormDataElement::data: |
| 87 result.type = Element::TypeData; | 87 result.type = Element::TypeData; |
| 88 result.data.assign(element.m_data.data(), element.m_data.size()); | 88 result.data.assign(element.m_data.data(), element.m_data.size()); |
| 89 break; | 89 break; |
| 90 case FormDataElement::encodedFile: | 90 case FormDataElement::encodedFile: |
| 91 result.type = Element::TypeFile; | 91 result.type = Element::TypeFile; |
| 92 result.filePath = element.m_filename; | 92 result.filePath = element.m_filename; |
| 93 #if ENABLE(BLOB) | 93 #if ENABLE(BLOB) |
| 94 result.fileStart = element.m_fileStart; | 94 result.fileStart = element.m_fileStart; |
| 95 result.fileLength = element.m_fileLength; | 95 result.fileLength = element.m_fileLength; |
| 96 result.modificationTime = element.m_expectedFileModificationTime; | 96 result.modificationTime = element.m_expectedFileModificationTime; |
| 97 #endif | 97 #endif |
| 98 break; | 98 break; |
| 99 #if ENABLE(BLOB) | 99 #if ENABLE(BLOB) |
| 100 case FormDataElement::encodedBlob: | 100 case FormDataElement::encodedBlob: |
| 101 result.type = Element::TypeBlob; | 101 result.type = Element::TypeBlob; |
| 102 result.url = element.m_url; | 102 result.blobUUID = element.m_blobUUID; |
| 103 result.blobURL = element.m_url; // FIXME: deprecate this. | |
| 104 break; | 103 break; |
| 105 #endif | 104 #endif |
| 106 #if ENABLE(FILE_SYSTEM) | 105 #if ENABLE(FILE_SYSTEM) |
| 107 case FormDataElement::encodedURL: | 106 case FormDataElement::encodedFileSystemURL: |
| 108 result.type = Element::TypeURL; | 107 result.type = Element::TypeFileSystemURL; |
| 109 result.url = element.m_url; | 108 result.fileSystemURL = element.m_fileSystemURL; |
| 110 result.fileStart = element.m_fileStart; | 109 result.fileStart = element.m_fileStart; |
| 111 result.fileLength = element.m_fileLength; | 110 result.fileLength = element.m_fileLength; |
| 112 result.modificationTime = element.m_expectedFileModificationTime; | 111 result.modificationTime = element.m_expectedFileModificationTime; |
| 113 break; | 112 break; |
| 114 #endif | 113 #endif |
| 115 default: | 114 default: |
| 116 ASSERT_NOT_REACHED(); | 115 ASSERT_NOT_REACHED(); |
| 117 return false; | 116 return false; |
| 118 } | 117 } |
| 119 | 118 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 135 } | 134 } |
| 136 | 135 |
| 137 void WebHTTPBody::appendFileRange(const WebString& filePath, long long fileStart
, long long fileLength, double modificationTime) | 136 void WebHTTPBody::appendFileRange(const WebString& filePath, long long fileStart
, long long fileLength, double modificationTime) |
| 138 { | 137 { |
| 139 #if ENABLE(BLOB) | 138 #if ENABLE(BLOB) |
| 140 ensureMutable(); | 139 ensureMutable(); |
| 141 m_private->appendFileRange(filePath, fileStart, fileLength, modificationTime
); | 140 m_private->appendFileRange(filePath, fileStart, fileLength, modificationTime
); |
| 142 #endif | 141 #endif |
| 143 } | 142 } |
| 144 | 143 |
| 145 void WebHTTPBody::appendURLRange(const WebURL& url, long long start, long long l
ength, double modificationTime) | 144 void WebHTTPBody::appendURLRange(const WebURL& fileSystemURL, long long start, l
ong long length, double modificationTime) |
| 146 { | 145 { |
| 147 #if ENABLE(FILE_SYSTEM) | 146 #if ENABLE(FILE_SYSTEM) |
| 148 // Currently we only support filesystem URL. | 147 // Currently we only support filesystem URL. |
| 149 ASSERT(KURL(url).protocolIs("filesystem")); | 148 ASSERT(KURL(fileSystemURL).protocolIs("filesystem")); |
| 150 ensureMutable(); | 149 ensureMutable(); |
| 151 m_private->appendURLRange(url, start, length, modificationTime); | 150 m_private->appendURLRange(fileSystemURL, start, length, modificationTime); |
| 152 #endif | 151 #endif |
| 153 } | 152 } |
| 154 | 153 |
| 155 void WebHTTPBody::appendBlob(const WebURL& blobURL) | 154 void WebHTTPBody::appendBlob(const WebString& blobUUID) |
| 156 { | 155 { |
| 157 #if ENABLE(BLOB) | 156 #if ENABLE(BLOB) |
| 158 ASSERT(KURL(blobURL).protocolIs("blob")); | |
| 159 ensureMutable(); | 157 ensureMutable(); |
| 160 m_private->appendBlob(blobURL); | 158 m_private->appendBlob(blobUUID, 0); |
| 159 // Note we're not holding a ref to a BlobDataHandle in the underlying FormDa
ta. |
| 161 #endif | 160 #endif |
| 162 } | 161 } |
| 163 | 162 |
| 164 long long WebHTTPBody::identifier() const | 163 long long WebHTTPBody::identifier() const |
| 165 { | 164 { |
| 166 ASSERT(!isNull()); | 165 ASSERT(!isNull()); |
| 167 return m_private->identifier(); | 166 return m_private->identifier(); |
| 168 } | 167 } |
| 169 | 168 |
| 170 void WebHTTPBody::setIdentifier(long long identifier) | 169 void WebHTTPBody::setIdentifier(long long identifier) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } | 207 } |
| 209 | 208 |
| 210 void WebHTTPBody::ensureMutable() | 209 void WebHTTPBody::ensureMutable() |
| 211 { | 210 { |
| 212 ASSERT(!isNull()); | 211 ASSERT(!isNull()); |
| 213 if (!m_private->hasOneRef()) | 212 if (!m_private->hasOneRef()) |
| 214 assign(static_cast<WebHTTPBodyPrivate*>(m_private->copy().leakRef())); | 213 assign(static_cast<WebHTTPBodyPrivate*>(m_private->copy().leakRef())); |
| 215 } | 214 } |
| 216 | 215 |
| 217 } // namespace WebKit | 216 } // namespace WebKit |
| OLD | NEW |