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

Unified Diff: Source/core/html/FormDataList.cpp

Issue 1311923004: Rename FormData/FormDataBuilder to EncodedFormData/FormDataEncoder respectively. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: update comments Created 5 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/FormDataList.h ('k') | Source/core/html/parser/XSSAuditor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/FormDataList.cpp
diff --git a/Source/core/html/FormDataList.cpp b/Source/core/html/FormDataList.cpp
index 1981dcf837421a938a7b5f14fd5845c14a3e9141..2a38045859d997087cc4b58427c92aade21154d1 100644
--- a/Source/core/html/FormDataList.cpp
+++ b/Source/core/html/FormDataList.cpp
@@ -22,7 +22,7 @@
#include "core/html/FormDataList.h"
#include "core/fileapi/File.h"
-#include "platform/network/FormDataBuilder.h"
+#include "platform/network/FormDataEncoder.h"
#include "platform/text/LineEnding.h"
#include "wtf/CurrentTime.h"
@@ -121,31 +121,31 @@ bool FormDataList::hasEntry(const String& key) const
return false;
}
-PassRefPtr<FormData> FormDataList::createFormData(FormData::EncodingType encodingType)
+PassRefPtr<EncodedFormData> FormDataList::createFormData(EncodedFormData::EncodingType encodingType)
{
- RefPtr<FormData> result = FormData::create();
+ RefPtr<EncodedFormData> result = EncodedFormData::create();
appendKeyValuePairItemsTo(result.get(), m_encoding, false, encodingType);
return result.release();
}
-PassRefPtr<FormData> FormDataList::createMultiPartFormData()
+PassRefPtr<EncodedFormData> FormDataList::createMultiPartFormData()
{
- RefPtr<FormData> result = FormData::create();
+ RefPtr<EncodedFormData> result = EncodedFormData::create();
appendKeyValuePairItemsTo(result.get(), m_encoding, true);
return result.release();
}
-void FormDataList::appendKeyValuePairItemsTo(FormData* formData, const WTF::TextEncoding& encoding, bool isMultiPartForm, FormData::EncodingType encodingType)
+void FormDataList::appendKeyValuePairItemsTo(EncodedFormData* formData, const WTF::TextEncoding& encoding, bool isMultiPartForm, EncodedFormData::EncodingType encodingType)
{
if (isMultiPartForm)
- formData->setBoundary(FormDataBuilder::generateUniqueBoundaryString());
+ formData->setBoundary(FormDataEncoder::generateUniqueBoundaryString());
Vector<char> encodedData;
for (const Item& item : items()) {
if (isMultiPartForm) {
Vector<char> header;
- FormDataBuilder::beginMultiPartHeader(header, formData->boundary().data(), item.key());
+ FormDataEncoder::beginMultiPartHeader(header, formData->boundary().data(), item.key());
// If the current type is blob, then we also need to include the filename
if (item.blob()) {
@@ -155,11 +155,13 @@ void FormDataList::appendKeyValuePairItemsTo(FormData* formData, const WTF::Text
// For file blob, use the filename (or relative path if it is present) as the name.
name = file->webkitRelativePath().isEmpty() ? file->name() : file->webkitRelativePath();
- // If a filename is passed in FormData.append(), use it instead of the file blob's name.
+ // If a filename is passed in DOMFormData.append(), use it
+ // instead of the file blob's name.
if (!item.filename().isNull())
name = item.filename();
} else {
- // For non-file blob, use the filename if it is passed in FormData.append().
+ // For non-file blob, use the filename if it is passed in
+ // DOMFormData.append().
if (!item.filename().isNull())
name = item.filename();
else
@@ -167,7 +169,7 @@ void FormDataList::appendKeyValuePairItemsTo(FormData* formData, const WTF::Text
}
// We have to include the filename=".." part in the header, even if the filename is empty
- FormDataBuilder::addFilenameToMultiPartHeader(header, encoding, name);
+ FormDataEncoder::addFilenameToMultiPartHeader(header, encoding, name);
// Add the content type if available, or "application/octet-stream" otherwise (RFC 1867).
String contentType;
@@ -175,10 +177,10 @@ void FormDataList::appendKeyValuePairItemsTo(FormData* formData, const WTF::Text
contentType = "application/octet-stream";
else
contentType = item.blob()->type();
- FormDataBuilder::addContentTypeToMultiPartHeader(header, contentType.latin1());
+ FormDataEncoder::addContentTypeToMultiPartHeader(header, contentType.latin1());
}
- FormDataBuilder::finishMultiPartHeader(header);
+ FormDataEncoder::finishMultiPartHeader(header);
// Append body
formData->appendData(header.data(), header.size());
@@ -198,12 +200,12 @@ void FormDataList::appendKeyValuePairItemsTo(FormData* formData, const WTF::Text
}
formData->appendData("\r\n", 2);
} else {
- FormDataBuilder::addKeyValuePairAsFormData(encodedData, item.key(), item.data(), encodingType);
+ FormDataEncoder::addKeyValuePairAsFormData(encodedData, item.key(), item.data(), encodingType);
}
}
if (isMultiPartForm)
- FormDataBuilder::addBoundaryToMultiPartHeader(encodedData, formData->boundary().data(), true);
+ FormDataEncoder::addBoundaryToMultiPartHeader(encodedData, formData->boundary().data(), true);
formData->appendData(encodedData.data(), encodedData.size());
}
« no previous file with comments | « Source/core/html/FormDataList.h ('k') | Source/core/html/parser/XSSAuditor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698