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