| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef Response_h | 5 #ifndef Response_h |
| 6 #define Response_h | 6 #define Response_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/Dictionary.h" | 8 #include "bindings/core/v8/Dictionary.h" |
| 9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
| 10 #include "modules/serviceworkers/Body.h" | 10 #include "modules/serviceworkers/Body.h" |
| 11 #include "modules/serviceworkers/FetchResponseData.h" | 11 #include "modules/serviceworkers/FetchResponseData.h" |
| 12 #include "modules/serviceworkers/Headers.h" | 12 #include "modules/serviceworkers/Headers.h" |
| 13 #include "platform/blob/BlobData.h" | 13 #include "platform/blob/BlobData.h" |
| 14 #include "platform/heap/Handle.h" | 14 #include "platform/heap/Handle.h" |
| 15 #include "wtf/Forward.h" | 15 #include "wtf/Forward.h" |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 | 18 |
| 19 class Blob; | 19 class Blob; |
| 20 class ExceptionState; | 20 class ExceptionState; |
| 21 class ResponseInit; | 21 class ResponseInit; |
| 22 class WebServiceWorkerResponse; | 22 class WebServiceWorkerResponse; |
| 23 | 23 |
| 24 class Response FINAL : public Body { | 24 class Response final : public Body { |
| 25 DEFINE_WRAPPERTYPEINFO(); | 25 DEFINE_WRAPPERTYPEINFO(); |
| 26 public: | 26 public: |
| 27 virtual ~Response() { } | 27 virtual ~Response() { } |
| 28 static Response* create(ExecutionContext*, Blob*, const Dictionary&, Excepti
onState&); | 28 static Response* create(ExecutionContext*, Blob*, const Dictionary&, Excepti
onState&); |
| 29 static Response* create(ExecutionContext*, const String&, const Dictionary&,
ExceptionState&); | 29 static Response* create(ExecutionContext*, const String&, const Dictionary&,
ExceptionState&); |
| 30 static Response* create(ExecutionContext*, const ArrayBuffer*, const Diction
ary&, ExceptionState&); | 30 static Response* create(ExecutionContext*, const ArrayBuffer*, const Diction
ary&, ExceptionState&); |
| 31 static Response* create(ExecutionContext*, const ArrayBufferView*, const Dic
tionary&, ExceptionState&); | 31 static Response* create(ExecutionContext*, const ArrayBufferView*, const Dic
tionary&, ExceptionState&); |
| 32 static Response* create(ExecutionContext*, Blob*, const ResponseInit&, Excep
tionState&); | 32 static Response* create(ExecutionContext*, Blob*, const ResponseInit&, Excep
tionState&); |
| 33 static Response* create(ExecutionContext*, FetchResponseData*); | 33 static Response* create(ExecutionContext*, FetchResponseData*); |
| 34 static Response* create(ExecutionContext*, const WebServiceWorkerResponse&); | 34 static Response* create(ExecutionContext*, const WebServiceWorkerResponse&); |
| 35 // The 'FetchResponseData' object is shared between responses, as it is | 35 // The 'FetchResponseData' object is shared between responses, as it is |
| 36 // immutable to the user after Response creation. Headers are copied. | 36 // immutable to the user after Response creation. Headers are copied. |
| 37 static Response* create(const Response&); | 37 static Response* create(const Response&); |
| 38 | 38 |
| 39 const FetchResponseData* response() const { return m_response; } | 39 const FetchResponseData* response() const { return m_response; } |
| 40 | 40 |
| 41 String type() const; | 41 String type() const; |
| 42 String url() const; | 42 String url() const; |
| 43 unsigned short status() const; | 43 unsigned short status() const; |
| 44 String statusText() const; | 44 String statusText() const; |
| 45 Headers* headers() const; | 45 Headers* headers() const; |
| 46 | 46 |
| 47 Response* clone() const; | 47 Response* clone() const; |
| 48 | 48 |
| 49 void populateWebServiceWorkerResponse(WebServiceWorkerResponse&); | 49 void populateWebServiceWorkerResponse(WebServiceWorkerResponse&); |
| 50 | 50 |
| 51 virtual void trace(Visitor*) OVERRIDE; | 51 virtual void trace(Visitor*) override; |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 explicit Response(const Response&); | 54 explicit Response(const Response&); |
| 55 explicit Response(ExecutionContext*); | 55 explicit Response(ExecutionContext*); |
| 56 Response(ExecutionContext*, FetchResponseData*); | 56 Response(ExecutionContext*, FetchResponseData*); |
| 57 | 57 |
| 58 virtual PassRefPtr<BlobDataHandle> blobDataHandle() OVERRIDE; | 58 virtual PassRefPtr<BlobDataHandle> blobDataHandle() override; |
| 59 | 59 |
| 60 const Member<FetchResponseData> m_response; | 60 const Member<FetchResponseData> m_response; |
| 61 const Member<Headers> m_headers; | 61 const Member<Headers> m_headers; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 } // namespace blink | 64 } // namespace blink |
| 65 | 65 |
| 66 #endif // Response_h | 66 #endif // Response_h |
| OLD | NEW |