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

Unified Diff: third_party/WebKit/Source/platform/network/mime/ContentType.cpp

Issue 2683083002: See what happens when ContentType becomes a ParsedContentType (Closed)
Patch Set: Created 3 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/mime/ContentType.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/mime/ContentType.cpp
diff --git a/third_party/WebKit/Source/platform/network/mime/ContentType.cpp b/third_party/WebKit/Source/platform/network/mime/ContentType.cpp
index cc1fa9dc02c8f872d4a015e597d53688f0c28d14..c47ac91a4d384250fea66cc3631a566f8a0aff6d 100644
--- a/third_party/WebKit/Source/platform/network/mime/ContentType.cpp
+++ b/third_party/WebKit/Source/platform/network/mime/ContentType.cpp
@@ -30,48 +30,15 @@
namespace blink {
-ContentType::ContentType(const String& contentType) : m_type(contentType) {}
+ContentType::ContentType(const String& contentType)
+ : m_type(contentType), m_content(contentType) {}
String ContentType::parameter(const String& parameterName) const {
- String parameterValue;
- String strippedType = m_type.stripWhiteSpace();
-
- // a MIME type can have one or more "param=value" after a semi-colon, and
- // separated from each other by semi-colons
- size_t semi = strippedType.find(';');
- if (semi != kNotFound) {
- size_t start =
- strippedType.find(parameterName, semi + 1, TextCaseASCIIInsensitive);
- if (start != kNotFound) {
- start = strippedType.find('=', start + parameterName.length());
- if (start != kNotFound) {
- size_t quote = strippedType.find('\"', start + 1);
- size_t end = strippedType.find('\"', start + 2);
- if (quote != kNotFound && end != kNotFound) {
- start = quote;
- } else {
- end = strippedType.find(';', start + 1);
- if (end == kNotFound)
- end = strippedType.length();
- }
- parameterValue = strippedType.substring(start + 1, end - (start + 1))
- .stripWhiteSpace();
- }
- }
- }
-
- return parameterValue;
+ return m_content.parameterValueForName(parameterName);
}
String ContentType::type() const {
- String strippedType = m_type.stripWhiteSpace();
-
- // "type" can have parameters after a semi-colon, strip them
- size_t semi = strippedType.find(';');
- if (semi != kNotFound)
- strippedType = strippedType.left(semi).stripWhiteSpace();
-
- return strippedType;
+ return m_content.mimeType();
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/network/mime/ContentType.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698