Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef FetchResponseData_h | |
| 6 #define FetchResponseData_h | |
| 7 | |
| 8 #include "platform/weborigin/KURL.h" | |
| 9 #include "wtf/PassRefPtr.h" | |
| 10 #include "wtf/RefCounted.h" | |
| 11 #include "wtf/text/AtomicString.h" | |
| 12 | |
| 13 namespace blink { class WebServiceWorkerResponse; } | |
| 14 | |
| 15 namespace WebCore { | |
| 16 | |
| 17 class BlobDataHandle; | |
| 18 class FetchHeaderList; | |
| 19 | |
| 20 class FetchResponseData : public RefCounted<FetchResponseData> { | |
| 21 public: | |
| 22 // "A response has an associated type which is one of basic, CORS, default, | |
| 23 // error, and opaque. Unless stated otherwise, it is default." | |
| 24 enum Type { BasicType, CORSType, DefaultType, ErrorType, OpaqueType }; | |
| 25 // "A response can have an associated termination reason which is one of | |
| 26 // end-user abort, fatal, and timeout." | |
| 27 enum TerminationReason { EndUserAbortTermination, FatalTermination, TimeoutT ermination }; | |
| 28 | |
| 29 static PassRefPtr<FetchResponseData> create(); | |
| 30 static PassRefPtr<FetchResponseData> createNetworkErrorResponse(); | |
| 31 | |
| 32 PassRefPtr<FetchResponseData> createBasicFilteredResponse(); | |
| 33 PassRefPtr<FetchResponseData> createCORSFilteredResponse(); | |
| 34 PassRefPtr<FetchResponseData> createOpaqueFilteredResponse(); | |
| 35 | |
| 36 Type type() const { return m_type; } | |
| 37 const KURL& url() const { return m_url; } | |
| 38 unsigned short status() const { return m_status; } | |
| 39 AtomicString statusMessage() const { return m_statusMessage; } | |
| 40 FetchHeaderList* headerList() const { return m_headerList.get(); } | |
| 41 PassRefPtr<BlobDataHandle> blobDataHandle() const { return m_blobDataHandle; } | |
| 42 | |
| 43 void setURL(const KURL& url) { m_url = url; } | |
| 44 void setStatus(unsigned short status) { m_status = status; } | |
| 45 void setStatusMessage(AtomicString statusMessage) { m_statusMessage = status Message; } | |
| 46 void setBlobDataHandle(PassRefPtr<BlobDataHandle> blobDataHandle) { m_blobDa taHandle = blobDataHandle; } | |
| 47 | |
| 48 void populateWebServiceWorkerResponse(blink::WebServiceWorkerResponse&); | |
| 49 | |
| 50 private: | |
| 51 FetchResponseData(Type, unsigned short, AtomicString); | |
| 52 | |
| 53 Type m_type; | |
| 54 OwnPtr<TerminationReason> m_terminationReason; | |
| 55 KURL m_url; | |
| 56 unsigned short m_status; | |
| 57 AtomicString m_statusMessage; | |
| 58 RefPtr<FetchHeaderList> m_headerList; | |
| 59 RefPtr<BlobDataHandle> m_blobDataHandle; | |
| 60 RefPtr<FetchResponseData> m_internalResponse; | |
| 61 }; | |
| 62 | |
| 63 | |
|
falken
2014/07/07 08:10:40
extra newline
horo
2014/07/07 10:19:44
Done.
| |
| 64 } // namespace WebCore | |
| 65 | |
| 66 #endif // FetchResponseData_h | |
| OLD | NEW |