| 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 Response_h | |
| 6 #define Response_h | |
| 7 | |
| 8 #include "bindings/core/v8/Dictionary.h" | |
| 9 #include "bindings/core/v8/ScriptWrappable.h" | |
| 10 #include "bindings/modules/v8/UnionTypesModules.h" | |
| 11 #include "modules/serviceworkers/Body.h" | |
| 12 #include "modules/serviceworkers/FetchResponseData.h" | |
| 13 #include "modules/serviceworkers/Headers.h" | |
| 14 #include "platform/blob/BlobData.h" | |
| 15 #include "platform/heap/Handle.h" | |
| 16 | |
| 17 namespace blink { | |
| 18 | |
| 19 class Blob; | |
| 20 class BodyStreamBuffer; | |
| 21 class DOMArrayBuffer; | |
| 22 class DOMArrayBufferView; | |
| 23 class ExceptionState; | |
| 24 class ResponseInit; | |
| 25 class WebServiceWorkerResponse; | |
| 26 | |
| 27 typedef BlobOrArrayBufferOrArrayBufferViewOrUSVString BodyInit; | |
| 28 | |
| 29 class Response final : public Body { | |
| 30 DEFINE_WRAPPERTYPEINFO(); | |
| 31 public: | |
| 32 ~Response() override { } | |
| 33 | |
| 34 // From Response.idl: | |
| 35 static Response* create(ExecutionContext*, ExceptionState&); | |
| 36 static Response* create(ExecutionContext*, const BodyInit&, const Dictionary
&, ExceptionState&); | |
| 37 | |
| 38 static Response* create(ExecutionContext*, Blob*, const ResponseInit&, Excep
tionState&); | |
| 39 static Response* create(ExecutionContext*, FetchResponseData*); | |
| 40 static Response* create(ExecutionContext*, const WebServiceWorkerResponse&); | |
| 41 | |
| 42 static Response* createClone(const Response&); | |
| 43 | |
| 44 const FetchResponseData* response() const { return m_response; } | |
| 45 | |
| 46 // From Response.idl: | |
| 47 String type() const; | |
| 48 String url() const; | |
| 49 unsigned short status() const; | |
| 50 String statusText() const; | |
| 51 Headers* headers() const; | |
| 52 | |
| 53 // From Response.idl: | |
| 54 Response* clone(ExceptionState&) const; | |
| 55 | |
| 56 void populateWebServiceWorkerResponse(WebServiceWorkerResponse&); | |
| 57 | |
| 58 bool hasBody() const; | |
| 59 | |
| 60 PassRefPtr<BlobDataHandle> blobDataHandle() const override; | |
| 61 BodyStreamBuffer* buffer() const override; | |
| 62 String contentTypeForBuffer() const override; | |
| 63 | |
| 64 PassRefPtr<BlobDataHandle> internalBlobDataHandle() const; | |
| 65 BodyStreamBuffer* internalBuffer() const; | |
| 66 String internalContentTypeForBuffer() const; | |
| 67 | |
| 68 void trace(Visitor*) override; | |
| 69 | |
| 70 private: | |
| 71 explicit Response(const Response&); | |
| 72 explicit Response(ExecutionContext*); | |
| 73 Response(ExecutionContext*, FetchResponseData*); | |
| 74 | |
| 75 const Member<FetchResponseData> m_response; | |
| 76 const Member<Headers> m_headers; | |
| 77 }; | |
| 78 | |
| 79 } // namespace blink | |
| 80 | |
| 81 #endif // Response_h | |
| OLD | NEW |