Chromium Code Reviews| 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/FetchBodyStream.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/RefPtr.h" | 15 #include "wtf/RefPtr.h" |
| 16 #include "wtf/text/WTFString.h" | 16 #include "wtf/text/WTFString.h" |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 class Blob; | 20 class Blob; |
| 21 class ExceptionState; | 21 class ExceptionState; |
| 22 class ResponseInit; | 22 class ResponseInit; |
| 23 class WebServiceWorkerResponse; | 23 class WebServiceWorkerResponse; |
| 24 | 24 |
| 25 class Response FINAL : public GarbageCollected<Response>, public ScriptWrappable { | 25 class Response FINAL : public Body { |
| 26 DEFINE_WRAPPERTYPEINFO(); | 26 DEFINE_WRAPPERTYPEINFO(); |
| 27 public: | 27 public: |
| 28 static Response* create(Blob*, const Dictionary&, ExceptionState&); | 28 virtual ~Response() { } |
| 29 static Response* create(const String&, const Dictionary&, ExceptionState&); | 29 static Response* create(ExecutionContext*, Blob*, const Dictionary&, Excepti onState&); |
| 30 static Response* create(Blob*, const ResponseInit&, ExceptionState&); | 30 static Response* create(ExecutionContext*, const String&, const Dictionary&, ExceptionState&); |
| 31 static Response* create(FetchResponseData*); | 31 static Response* create(ExecutionContext*, Blob*, const ResponseInit&, Excep tionState&); |
| 32 static Response* create(const WebServiceWorkerResponse&); | 32 static Response* create(ExecutionContext*, FetchResponseData*); |
| 33 static Response* create(ExecutionContext*, const WebServiceWorkerResponse&); | |
| 33 | 34 |
| 34 String type() const; | 35 String type() const; |
| 35 String url() const; | 36 String url() const; |
| 36 unsigned short status() const; | 37 unsigned short status() const; |
| 37 String statusText() const; | 38 String statusText() const; |
| 38 Headers* headers() const; | 39 Headers* headers() const; |
| 39 | 40 |
| 40 FetchBodyStream* body(ExecutionContext*); | |
| 41 | |
| 42 void populateWebServiceWorkerResponse(WebServiceWorkerResponse&); | 41 void populateWebServiceWorkerResponse(WebServiceWorkerResponse&); |
| 43 | 42 |
| 44 void trace(Visitor*); | 43 virtual void trace(Visitor*) OVERRIDE; |
| 45 | 44 |
| 46 private: | 45 private: |
| 47 Response(); | 46 Response(ExecutionContext*); |
|
jsbell
2014/09/09 22:04:25
single argument constructor should have `explicit`
horo
2014/09/10 06:18:44
Done.
| |
| 48 explicit Response(FetchResponseData*); | 47 Response(ExecutionContext*, FetchResponseData*); |
| 49 explicit Response(const WebServiceWorkerResponse&); | 48 Response(ExecutionContext*, const WebServiceWorkerResponse&); |
| 49 | |
| 50 virtual PassRefPtr<BlobDataHandle> blobDataHandle() OVERRIDE; | |
| 50 | 51 |
| 51 Member<FetchResponseData> m_response; | 52 Member<FetchResponseData> m_response; |
| 52 Member<Headers> m_headers; | 53 Member<Headers> m_headers; |
| 53 Member<FetchBodyStream> m_fetchBodyStream; | |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 } // namespace blink | 56 } // namespace blink |
| 57 | 57 |
| 58 #endif // Response_h | 58 #endif // Response_h |
| OLD | NEW |