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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/xml/XMLHttpRequest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com> 3 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com>
4 * Copyright (C) 2011 Google Inc. All rights reserved. 4 * Copyright (C) 2011 Google Inc. All rights reserved.
5 * Copyright (C) 2012 Intel Corporation 5 * Copyright (C) 2012 Intel Corporation
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public 8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 virtual void didSendData(unsigned long long bytesSent, unsigned long long to talBytesToBeSent) OVERRIDE; 153 virtual void didSendData(unsigned long long bytesSent, unsigned long long to talBytesToBeSent) OVERRIDE;
154 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp onse&) OVERRIDE; 154 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp onse&) OVERRIDE;
155 virtual void didReceiveData(const char* data, int dataLength) OVERRIDE; 155 virtual void didReceiveData(const char* data, int dataLength) OVERRIDE;
156 // When responseType is set to "blob", didDownloadData() is called instead 156 // When responseType is set to "blob", didDownloadData() is called instead
157 // of didReceiveData(). 157 // of didReceiveData().
158 virtual void didDownloadData(int dataLength) OVERRIDE; 158 virtual void didDownloadData(int dataLength) OVERRIDE;
159 virtual void didFinishLoading(unsigned long identifier, double finishTime) O VERRIDE; 159 virtual void didFinishLoading(unsigned long identifier, double finishTime) O VERRIDE;
160 virtual void didFail(const ResourceError&) OVERRIDE; 160 virtual void didFail(const ResourceError&) OVERRIDE;
161 virtual void didFailRedirectCheck() OVERRIDE; 161 virtual void didFailRedirectCheck() OVERRIDE;
162 162
163 AtomicString responseMIMEType() const; 163 // Returns the MIME type part of m_mimeTypeOverride if present and
164 // successfully parsed, or returns one of the "Content-Type" header value
165 // of the received response.
166 //
167 // This method is named after the term "final MIME type" defined in the
168 // spec but doesn't convert the result to ASCII lowercase as specified in
169 // the spec. Must be lowered later or compared using case insensitive
170 // comparison functions if required.
171 AtomicString finalResponseMIMEType() const;
172 // The same as finalResponseMIMEType() but fallbacks to "text/xml" if
173 // finalResponseMIMEType() returns an empty string.
174 AtomicString finalResponseMIMETypeWithFallback() const;
164 bool responseIsXML() const; 175 bool responseIsXML() const;
165 176
166 PassOwnPtr<TextResourceDecoder> createDecoder() const; 177 PassOwnPtr<TextResourceDecoder> createDecoder() const;
167 178
168 void initResponseDocument(); 179 void initResponseDocument();
169 bool areMethodAndURLValidForSend(); 180 bool areMethodAndURLValidForSend();
170 181
171 bool initSend(ExceptionState&); 182 bool initSend(ExceptionState&);
172 void sendBytesData(const void*, size_t, ExceptionState&); 183 void sendBytesData(const void*, size_t, ExceptionState&);
173 184
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // Handles didFail() call for timeout. 216 // Handles didFail() call for timeout.
206 void handleDidTimeout(); 217 void handleDidTimeout();
207 218
208 void handleRequestError(ExceptionCode, const AtomicString&, long long, long long); 219 void handleRequestError(ExceptionCode, const AtomicString&, long long, long long);
209 220
210 OwnPtrWillBeMember<XMLHttpRequestUpload> m_upload; 221 OwnPtrWillBeMember<XMLHttpRequestUpload> m_upload;
211 222
212 KURL m_url; 223 KURL m_url;
213 AtomicString m_method; 224 AtomicString m_method;
214 HTTPHeaderMap m_requestHeaders; 225 HTTPHeaderMap m_requestHeaders;
226 // Not converted to ASCII lowercase. Must be lowered later or compared
227 // using case insensitive comparison functions if needed.
215 AtomicString m_mimeTypeOverride; 228 AtomicString m_mimeTypeOverride;
216 unsigned long m_timeoutMilliseconds; 229 unsigned long m_timeoutMilliseconds;
217 RefPtrWillBeMember<Blob> m_responseBlob; 230 RefPtrWillBeMember<Blob> m_responseBlob;
218 RefPtrWillBeMember<Stream> m_responseStream; 231 RefPtrWillBeMember<Stream> m_responseStream;
219 232
220 RefPtr<ThreadableLoader> m_loader; 233 RefPtr<ThreadableLoader> m_loader;
221 State m_state; 234 State m_state;
222 235
223 ResourceResponse m_response; 236 ResourceResponse m_response;
224 String m_responseEncoding; 237 String m_finalResponseCharset;
225 238
226 OwnPtr<TextResourceDecoder> m_decoder; 239 OwnPtr<TextResourceDecoder> m_decoder;
227 240
228 ScriptString m_responseText; 241 ScriptString m_responseText;
229 RefPtrWillBeMember<Document> m_responseDocument; 242 RefPtrWillBeMember<Document> m_responseDocument;
230 243
231 RefPtr<SharedBuffer> m_binaryResponseBuilder; 244 RefPtr<SharedBuffer> m_binaryResponseBuilder;
232 long long m_downloadedBlobLength; 245 long long m_downloadedBlobLength;
233 246
234 RefPtr<ArrayBuffer> m_responseArrayBuffer; 247 RefPtr<ArrayBuffer> m_responseArrayBuffer;
(...skipping 23 matching lines...) Expand all
258 bool m_parsedResponse; 271 bool m_parsedResponse;
259 bool m_error; 272 bool m_error;
260 bool m_uploadEventsAllowed; 273 bool m_uploadEventsAllowed;
261 bool m_uploadComplete; 274 bool m_uploadComplete;
262 bool m_sameOriginRequest; 275 bool m_sameOriginRequest;
263 }; 276 };
264 277
265 } // namespace blink 278 } // namespace blink
266 279
267 #endif // XMLHttpRequest_h 280 #endif // XMLHttpRequest_h
OLDNEW
« 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