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

Unified Diff: third_party/WebKit/Source/platform/network/FormDataEncoder.cpp

Issue 1698883005: Remove internal use of Document::defaultCharset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « third_party/WebKit/Source/platform/network/FormDataEncoder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/network/FormDataEncoder.cpp
diff --git a/third_party/WebKit/Source/platform/network/FormDataEncoder.cpp b/third_party/WebKit/Source/platform/network/FormDataEncoder.cpp
index 4e4f32ed314b16d22d5f7f9638fb51609a176a5f..3b7bd1a6ae9b68fea42a4d58e7395841e81ffe68 100644
--- a/third_party/WebKit/Source/platform/network/FormDataEncoder.cpp
+++ b/third_party/WebKit/Source/platform/network/FormDataEncoder.cpp
@@ -73,30 +73,23 @@ static void appendQuotedString(Vector<char>& buffer, const CString& string)
}
}
-WTF::TextEncoding FormDataEncoder::encodingFromAcceptCharset(const String& acceptCharset, const String& charset, const String& defaultCharset)
+WTF::TextEncoding FormDataEncoder::encodingFromAcceptCharset(const String& acceptCharset, const WTF::TextEncoding& fallbackEncoding)
{
+ ASSERT(fallbackEncoding.isValid());
+
String normalizedAcceptCharset = acceptCharset;
normalizedAcceptCharset.replace(',', ' ');
Vector<String> charsets;
normalizedAcceptCharset.split(' ', charsets);
- WTF::TextEncoding encoding;
-
- Vector<String>::const_iterator end = charsets.end();
- for (Vector<String>::const_iterator it = charsets.begin(); it != end; ++it) {
- if ((encoding = WTF::TextEncoding(*it)).isValid())
+ for (const String& name : charsets) {
+ WTF::TextEncoding encoding(name);
+ if (encoding.isValid())
return encoding;
}
- if (charset.isEmpty()) {
- if (defaultCharset.isEmpty())
- return WTF::UTF8Encoding();
-
- return defaultCharset;
- }
-
- return charset;
+ return fallbackEncoding;
}
Vector<char> FormDataEncoder::generateUniqueBoundaryString()
« no previous file with comments | « third_party/WebKit/Source/platform/network/FormDataEncoder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698