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

Unified Diff: third_party/WebKit/Source/platform/network/ParsedContentType.h

Issue 2704153002: ParsedContentType refactoring (Closed)
Patch Set: fix 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
Index: third_party/WebKit/Source/platform/network/ParsedContentType.h
diff --git a/third_party/WebKit/Source/platform/network/ParsedContentType.h b/third_party/WebKit/Source/platform/network/ParsedContentType.h
index d59f6047edd150f1e33f1c1cd0abc2593340a8e8..9a8aae915435b61bd9be3e4c98ec453f9cd20e67 100644
--- a/third_party/WebKit/Source/platform/network/ParsedContentType.h
+++ b/third_party/WebKit/Source/platform/network/ParsedContentType.h
@@ -39,15 +39,16 @@
namespace blink {
-// <index, length>
-typedef std::pair<unsigned, unsigned> SubstringRange;
-PLATFORM_EXPORT bool isValidContentType(const String&);
-
+// ParsedContentType parses the constructor argument as specified in RFC2045
+// and stores the result.
// FIXME: add support for comments.
class PLATFORM_EXPORT ParsedContentType final {
STACK_ALLOCATED();
public:
+ // <index, length>
+ using SubstringRange = std::pair<unsigned, unsigned>;
+
explicit ParsedContentType(const String&);
String mimeType() const { return m_mimeType; }
@@ -58,14 +59,13 @@ class PLATFORM_EXPORT ParsedContentType final {
String parameterValueForName(const String&) const;
size_t parameterCount() const;
+ bool isValid() const { return m_isValid; }
+
private:
- template <class ReceiverType>
- friend bool parseContentType(const String&, ReceiverType&);
- void setContentType(const SubstringRange&);
- void setContentTypeParameter(const SubstringRange&, const SubstringRange&);
+ bool parse(const String&);
+ bool m_isValid;
typedef HashMap<String, String> KeyValuePairs;
- String m_contentType;
KeyValuePairs m_parameters;
String m_mimeType;
};

Powered by Google App Engine
This is Rietveld 408576698