OLD | NEW |
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 19 matching lines...) Expand all Loading... |
30 #include "core/loader/ThreadableLoaderClient.h" | 30 #include "core/loader/ThreadableLoaderClient.h" |
31 #include "core/xmlhttprequest/XMLHttpRequestEventTarget.h" | 31 #include "core/xmlhttprequest/XMLHttpRequestEventTarget.h" |
32 #include "core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.h" | 32 #include "core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.h" |
33 #include "platform/heap/Handle.h" | 33 #include "platform/heap/Handle.h" |
34 #include "platform/network/EncodedFormData.h" | 34 #include "platform/network/EncodedFormData.h" |
35 #include "platform/network/HTTPHeaderMap.h" | 35 #include "platform/network/HTTPHeaderMap.h" |
36 #include "platform/network/ResourceResponse.h" | 36 #include "platform/network/ResourceResponse.h" |
37 #include "platform/weborigin/KURL.h" | 37 #include "platform/weborigin/KURL.h" |
38 #include "platform/weborigin/SecurityOrigin.h" | 38 #include "platform/weborigin/SecurityOrigin.h" |
39 #include "wtf/Forward.h" | 39 #include "wtf/Forward.h" |
40 #include "wtf/OwnPtr.h" | |
41 #include "wtf/PassOwnPtr.h" | |
42 #include "wtf/PassRefPtr.h" | 40 #include "wtf/PassRefPtr.h" |
43 #include "wtf/RefPtr.h" | 41 #include "wtf/RefPtr.h" |
44 #include "wtf/text/AtomicString.h" | 42 #include "wtf/text/AtomicString.h" |
45 #include "wtf/text/StringBuilder.h" | 43 #include "wtf/text/StringBuilder.h" |
46 #include "wtf/text/WTFString.h" | 44 #include "wtf/text/WTFString.h" |
| 45 #include <memory> |
47 | 46 |
48 namespace blink { | 47 namespace blink { |
49 | 48 |
50 class ArrayBufferOrArrayBufferViewOrBlobOrDocumentOrStringOrFormData; | 49 class ArrayBufferOrArrayBufferViewOrBlobOrDocumentOrStringOrFormData; |
51 class Blob; | 50 class Blob; |
52 class BlobDataHandle; | 51 class BlobDataHandle; |
53 class DOMArrayBuffer; | 52 class DOMArrayBuffer; |
54 class DOMArrayBufferView; | 53 class DOMArrayBufferView; |
55 class Document; | 54 class Document; |
56 class DocumentParser; | 55 class DocumentParser; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 DECLARE_VIRTUAL_TRACE(); | 149 DECLARE_VIRTUAL_TRACE(); |
151 | 150 |
152 private: | 151 private: |
153 class BlobLoader; | 152 class BlobLoader; |
154 XMLHttpRequest(ExecutionContext*, PassRefPtr<SecurityOrigin>); | 153 XMLHttpRequest(ExecutionContext*, PassRefPtr<SecurityOrigin>); |
155 | 154 |
156 Document* document() const; | 155 Document* document() const; |
157 SecurityOrigin* getSecurityOrigin() const; | 156 SecurityOrigin* getSecurityOrigin() const; |
158 | 157 |
159 void didSendData(unsigned long long bytesSent, unsigned long long totalBytes
ToBeSent) override; | 158 void didSendData(unsigned long long bytesSent, unsigned long long totalBytes
ToBeSent) override; |
160 void didReceiveResponse(unsigned long identifier, const ResourceResponse&, P
assOwnPtr<WebDataConsumerHandle>) override; | 159 void didReceiveResponse(unsigned long identifier, const ResourceResponse&, s
td::unique_ptr<WebDataConsumerHandle>) override; |
161 void didReceiveData(const char* data, unsigned dataLength) override; | 160 void didReceiveData(const char* data, unsigned dataLength) override; |
162 // When responseType is set to "blob", didDownloadData() is called instead | 161 // When responseType is set to "blob", didDownloadData() is called instead |
163 // of didReceiveData(). | 162 // of didReceiveData(). |
164 void didDownloadData(int dataLength) override; | 163 void didDownloadData(int dataLength) override; |
165 void didFinishLoading(unsigned long identifier, double finishTime) override; | 164 void didFinishLoading(unsigned long identifier, double finishTime) override; |
166 void didFail(const ResourceError&) override; | 165 void didFail(const ResourceError&) override; |
167 void didFailRedirectCheck() override; | 166 void didFailRedirectCheck() override; |
168 | 167 |
169 // BlobLoader notifications. | 168 // BlobLoader notifications. |
170 void didFinishLoadingInternal(); | 169 void didFinishLoadingInternal(); |
(...skipping 15 matching lines...) Expand all Loading... |
186 // spec but doesn't convert the result to ASCII lowercase as specified in | 185 // spec but doesn't convert the result to ASCII lowercase as specified in |
187 // the spec. Must be lowered later or compared using case insensitive | 186 // the spec. Must be lowered later or compared using case insensitive |
188 // comparison functions if required. | 187 // comparison functions if required. |
189 AtomicString finalResponseMIMEType() const; | 188 AtomicString finalResponseMIMEType() const; |
190 // The same as finalResponseMIMEType() but fallbacks to "text/xml" if | 189 // The same as finalResponseMIMEType() but fallbacks to "text/xml" if |
191 // finalResponseMIMEType() returns an empty string. | 190 // finalResponseMIMEType() returns an empty string. |
192 AtomicString finalResponseMIMETypeWithFallback() const; | 191 AtomicString finalResponseMIMETypeWithFallback() const; |
193 bool responseIsXML() const; | 192 bool responseIsXML() const; |
194 bool responseIsHTML() const; | 193 bool responseIsHTML() const; |
195 | 194 |
196 PassOwnPtr<TextResourceDecoder> createDecoder() const; | 195 std::unique_ptr<TextResourceDecoder> createDecoder() const; |
197 | 196 |
198 void initResponseDocument(); | 197 void initResponseDocument(); |
199 void parseDocumentChunk(const char* data, unsigned dataLength); | 198 void parseDocumentChunk(const char* data, unsigned dataLength); |
200 | 199 |
201 bool areMethodAndURLValidForSend(); | 200 bool areMethodAndURLValidForSend(); |
202 | 201 |
203 void throwForLoadFailureIfNeeded(ExceptionState&, const String&); | 202 void throwForLoadFailureIfNeeded(ExceptionState&, const String&); |
204 | 203 |
205 bool initSend(ExceptionState&); | 204 bool initSend(ExceptionState&); |
206 void sendBytesData(const void*, size_t, ExceptionState&); | 205 void sendBytesData(const void*, size_t, ExceptionState&); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 KURL m_url; | 257 KURL m_url; |
259 AtomicString m_method; | 258 AtomicString m_method; |
260 HTTPHeaderMap m_requestHeaders; | 259 HTTPHeaderMap m_requestHeaders; |
261 // Not converted to ASCII lowercase. Must be lowered later or compared | 260 // Not converted to ASCII lowercase. Must be lowered later or compared |
262 // using case insensitive comparison functions if needed. | 261 // using case insensitive comparison functions if needed. |
263 AtomicString m_mimeTypeOverride; | 262 AtomicString m_mimeTypeOverride; |
264 unsigned long m_timeoutMilliseconds; | 263 unsigned long m_timeoutMilliseconds; |
265 Member<Blob> m_responseBlob; | 264 Member<Blob> m_responseBlob; |
266 Member<Stream> m_responseLegacyStream; | 265 Member<Stream> m_responseLegacyStream; |
267 | 266 |
268 OwnPtr<ThreadableLoader> m_loader; | 267 std::unique_ptr<ThreadableLoader> m_loader; |
269 State m_state; | 268 State m_state; |
270 | 269 |
271 ResourceResponse m_response; | 270 ResourceResponse m_response; |
272 String m_finalResponseCharset; | 271 String m_finalResponseCharset; |
273 | 272 |
274 OwnPtr<TextResourceDecoder> m_decoder; | 273 std::unique_ptr<TextResourceDecoder> m_decoder; |
275 | 274 |
276 ScriptString m_responseText; | 275 ScriptString m_responseText; |
277 Member<Document> m_responseDocument; | 276 Member<Document> m_responseDocument; |
278 Member<DocumentParser> m_responseDocumentParser; | 277 Member<DocumentParser> m_responseDocumentParser; |
279 | 278 |
280 RefPtr<SharedBuffer> m_binaryResponseBuilder; | 279 RefPtr<SharedBuffer> m_binaryResponseBuilder; |
281 long long m_lengthDownloadedToFile; | 280 long long m_lengthDownloadedToFile; |
282 | 281 |
283 Member<DOMArrayBuffer> m_responseArrayBuffer; | 282 Member<DOMArrayBuffer> m_responseArrayBuffer; |
284 | 283 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 bool m_sameOriginRequest; | 315 bool m_sameOriginRequest; |
317 // True iff the ongoing resource loading is using the downloadToFile | 316 // True iff the ongoing resource loading is using the downloadToFile |
318 // option. | 317 // option. |
319 bool m_downloadingToFile; | 318 bool m_downloadingToFile; |
320 bool m_responseTextOverflow; | 319 bool m_responseTextOverflow; |
321 }; | 320 }; |
322 | 321 |
323 } // namespace blink | 322 } // namespace blink |
324 | 323 |
325 #endif // XMLHttpRequest_h | 324 #endif // XMLHttpRequest_h |
OLD | NEW |