| 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/heap/Handle.h" | |
| 9 #include "platform/weborigin/KURL.h" | |
| 10 #include "wtf/PassRefPtr.h" | |
| 11 #include "wtf/text/AtomicString.h" | |
| 12 | |
| 13 namespace blink { | |
| 14 | |
| 15 class BlobDataHandle; | |
| 16 class BodyStreamBuffer; | |
| 17 class FetchHeaderList; | |
| 18 class WebServiceWorkerResponse; | |
| 19 | |
| 20 class FetchResponseData final : public GarbageCollectedFinalized<FetchResponseDa
ta> { | |
| 21 WTF_MAKE_NONCOPYABLE(FetchResponseData); | |
| 22 public: | |
| 23 // "A response has an associated type which is one of basic, CORS, default, | |
| 24 // error, and opaque. Unless stated otherwise, it is default." | |
| 25 enum Type { BasicType, CORSType, DefaultType, ErrorType, OpaqueType }; | |
| 26 // "A response can have an associated termination reason which is one of | |
| 27 // end-user abort, fatal, and timeout." | |
| 28 enum TerminationReason { EndUserAbortTermination, FatalTermination, TimeoutT
ermination }; | |
| 29 | |
| 30 static FetchResponseData* create(); | |
| 31 static FetchResponseData* createNetworkErrorResponse(); | |
| 32 static FetchResponseData* createWithBuffer(BodyStreamBuffer*); | |
| 33 | |
| 34 FetchResponseData* createBasicFilteredResponse(); | |
| 35 FetchResponseData* createCORSFilteredResponse(); | |
| 36 FetchResponseData* createOpaqueFilteredResponse(); | |
| 37 | |
| 38 FetchResponseData* clone(); | |
| 39 | |
| 40 Type type() const { return m_type; } | |
| 41 const KURL& url() const { return m_url; } | |
| 42 unsigned short status() const { return m_status; } | |
| 43 AtomicString statusMessage() const { return m_statusMessage; } | |
| 44 FetchHeaderList* headerList() const { return m_headerList.get(); } | |
| 45 PassRefPtr<BlobDataHandle> blobDataHandle() const { return m_blobDataHandle;
} | |
| 46 BodyStreamBuffer* buffer() const { return m_buffer; } | |
| 47 String contentTypeForBuffer() const; | |
| 48 PassRefPtr<BlobDataHandle> internalBlobDataHandle() const; | |
| 49 BodyStreamBuffer* internalBuffer() const; | |
| 50 String internalContentTypeForBuffer() const; | |
| 51 | |
| 52 void setURL(const KURL& url) { m_url = url; } | |
| 53 void setStatus(unsigned short status) { m_status = status; } | |
| 54 void setStatusMessage(AtomicString statusMessage) { m_statusMessage = status
Message; } | |
| 55 void setBlobDataHandle(PassRefPtr<BlobDataHandle>); | |
| 56 void setContentTypeForBuffer(const String& contentType) { m_contentTypeForBu
ffer = contentType; } | |
| 57 | |
| 58 void populateWebServiceWorkerResponse(blink::WebServiceWorkerResponse&); | |
| 59 | |
| 60 void trace(Visitor*); | |
| 61 | |
| 62 private: | |
| 63 FetchResponseData(Type, unsigned short, AtomicString); | |
| 64 | |
| 65 Type m_type; | |
| 66 OwnPtr<TerminationReason> m_terminationReason; | |
| 67 KURL m_url; | |
| 68 unsigned short m_status; | |
| 69 AtomicString m_statusMessage; | |
| 70 Member<FetchHeaderList> m_headerList; | |
| 71 RefPtr<BlobDataHandle> m_blobDataHandle; | |
| 72 Member<FetchResponseData> m_internalResponse; | |
| 73 Member<BodyStreamBuffer> m_buffer; | |
| 74 String m_contentTypeForBuffer; | |
| 75 }; | |
| 76 | |
| 77 } // namespace blink | |
| 78 | |
| 79 #endif // FetchResponseData_h | |
| OLD | NEW |