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

Unified Diff: Source/core/xml/XMLHttpRequest.h

Issue 450103003: Refactor MIME type related methods in XHR for readability (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed #2 Created 6 years, 4 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 | « no previous file | Source/core/xml/XMLHttpRequest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xml/XMLHttpRequest.h
diff --git a/Source/core/xml/XMLHttpRequest.h b/Source/core/xml/XMLHttpRequest.h
index d2060c8c27ee07eae3983a779c186437975e60f5..5b6abc437918101b27e896c7360ac00c805ce47c 100644
--- a/Source/core/xml/XMLHttpRequest.h
+++ b/Source/core/xml/XMLHttpRequest.h
@@ -160,7 +160,18 @@ private:
virtual void didFail(const ResourceError&) OVERRIDE;
virtual void didFailRedirectCheck() OVERRIDE;
- AtomicString responseMIMEType() const;
+ // Returns the MIME type part of m_mimeTypeOverride if present and
+ // successfully parsed, or returns one of the "Content-Type" header value
+ // of the received response.
+ //
+ // This method is named after the term "final MIME type" defined in the
+ // spec but doesn't convert the result to ASCII lowercase as specified in
+ // the spec. Must be lowered later or compared using case insensitive
+ // comparison functions if required.
+ AtomicString finalResponseMIMEType() const;
+ // The same as finalResponseMIMEType() but fallbacks to "text/xml" if
+ // finalResponseMIMEType() returns an empty string.
+ AtomicString finalResponseMIMETypeWithFallback() const;
bool responseIsXML() const;
PassOwnPtr<TextResourceDecoder> createDecoder() const;
@@ -212,6 +223,8 @@ private:
KURL m_url;
AtomicString m_method;
HTTPHeaderMap m_requestHeaders;
+ // Not converted to ASCII lowercase. Must be lowered later or compared
+ // using case insensitive comparison functions if needed.
AtomicString m_mimeTypeOverride;
unsigned long m_timeoutMilliseconds;
RefPtrWillBeMember<Blob> m_responseBlob;
@@ -221,7 +234,7 @@ private:
State m_state;
ResourceResponse m_response;
- String m_responseEncoding;
+ String m_finalResponseCharset;
OwnPtr<TextResourceDecoder> m_decoder;
« no previous file with comments | « no previous file | Source/core/xml/XMLHttpRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698