| 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 Request_h | 5 #ifndef Request_h |
| 6 #define Request_h | 6 #define Request_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 "bindings/modules/v8/UnionTypesModules.h" | 10 #include "bindings/modules/v8/UnionTypesModules.h" |
| 11 #include "modules/serviceworkers/Body.h" | 11 #include "modules/serviceworkers/Body.h" |
| 12 #include "modules/serviceworkers/FetchRequestData.h" | 12 #include "modules/serviceworkers/FetchRequestData.h" |
| 13 #include "modules/serviceworkers/Headers.h" | 13 #include "modules/serviceworkers/Headers.h" |
| 14 #include "platform/heap/Handle.h" | 14 #include "platform/heap/Handle.h" |
| 15 #include "platform/weborigin/KURL.h" | 15 #include "platform/weborigin/KURL.h" |
| 16 #include "public/platform/WebURLRequest.h" | 16 #include "public/platform/WebURLRequest.h" |
| 17 #include "wtf/RefPtr.h" | 17 #include "wtf/RefPtr.h" |
| 18 #include "wtf/text/WTFString.h" | 18 #include "wtf/text/WTFString.h" |
| 19 | 19 |
| 20 namespace blink { | 20 namespace blink { |
| 21 | 21 |
| 22 class BodyStreamBuffer; |
| 22 class RequestInit; | 23 class RequestInit; |
| 23 class WebServiceWorkerRequest; | 24 class WebServiceWorkerRequest; |
| 24 | 25 |
| 25 typedef RequestOrUSVString RequestInfo; | 26 typedef RequestOrUSVString RequestInfo; |
| 26 | 27 |
| 27 class Request final : public Body { | 28 class Request final : public Body { |
| 28 DEFINE_WRAPPERTYPEINFO(); | 29 DEFINE_WRAPPERTYPEINFO(); |
| 29 public: | 30 public: |
| 30 virtual ~Request() { } | 31 ~Request() override { } |
| 31 | 32 |
| 32 // From Request.idl: | 33 // From Request.idl: |
| 33 static Request* create(ExecutionContext*, const RequestInfo&, const Dictiona
ry&, ExceptionState&); | 34 static Request* create(ExecutionContext*, const RequestInfo&, const Dictiona
ry&, ExceptionState&); |
| 34 | 35 |
| 35 static Request* create(ExecutionContext*, const String&, ExceptionState&); | 36 static Request* create(ExecutionContext*, const String&, ExceptionState&); |
| 36 static Request* create(ExecutionContext*, const String&, const Dictionary&,
ExceptionState&); | 37 static Request* create(ExecutionContext*, const String&, const Dictionary&,
ExceptionState&); |
| 37 static Request* create(ExecutionContext*, Request*, ExceptionState&); | 38 static Request* create(ExecutionContext*, Request*, ExceptionState&); |
| 38 static Request* create(ExecutionContext*, Request*, const Dictionary&, Excep
tionState&); | 39 static Request* create(ExecutionContext*, Request*, const Dictionary&, Excep
tionState&); |
| 39 static Request* create(ExecutionContext*, FetchRequestData*); | 40 static Request* create(ExecutionContext*, FetchRequestData*); |
| 40 static Request* create(ExecutionContext*, const WebServiceWorkerRequest&); | 41 static Request* create(ExecutionContext*, const WebServiceWorkerRequest&); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 53 String credentials() const; | 54 String credentials() const; |
| 54 | 55 |
| 55 // From Request.idl: | 56 // From Request.idl: |
| 56 Request* clone(ExceptionState&) const; | 57 Request* clone(ExceptionState&) const; |
| 57 | 58 |
| 58 void populateWebServiceWorkerRequest(WebServiceWorkerRequest&) const; | 59 void populateWebServiceWorkerRequest(WebServiceWorkerRequest&) const; |
| 59 | 60 |
| 60 void setBodyBlobHandle(PassRefPtr<BlobDataHandle>); | 61 void setBodyBlobHandle(PassRefPtr<BlobDataHandle>); |
| 61 bool hasBody() const { return m_request->blobDataHandle(); } | 62 bool hasBody() const { return m_request->blobDataHandle(); } |
| 62 | 63 |
| 63 virtual void trace(Visitor*) override; | 64 void trace(Visitor*) override; |
| 64 | 65 |
| 65 private: | 66 private: |
| 66 explicit Request(const Request&); | 67 explicit Request(const Request&); |
| 67 Request(ExecutionContext*, FetchRequestData*); | 68 Request(ExecutionContext*, FetchRequestData*); |
| 68 Request(ExecutionContext*, const WebServiceWorkerRequest&); | 69 Request(ExecutionContext*, const WebServiceWorkerRequest&); |
| 69 | 70 |
| 70 static Request* createRequestWithRequestOrString(ExecutionContext*, Request*
, const String&, const RequestInit&, ExceptionState&); | 71 static Request* createRequestWithRequestOrString(ExecutionContext*, Request*
, const String&, const RequestInit&, ExceptionState&); |
| 71 void clearHeaderList(); | 72 void clearHeaderList(); |
| 72 | 73 |
| 73 virtual PassRefPtr<BlobDataHandle> blobDataHandle() override; | 74 PassRefPtr<BlobDataHandle> blobDataHandle() const override; |
| 75 BodyStreamBuffer* buffer() const override; |
| 76 String contentType() const override; |
| 74 | 77 |
| 75 const Member<FetchRequestData> m_request; | 78 const Member<FetchRequestData> m_request; |
| 76 const Member<Headers> m_headers; | 79 const Member<Headers> m_headers; |
| 77 }; | 80 }; |
| 78 | 81 |
| 79 } // namespace blink | 82 } // namespace blink |
| 80 | 83 |
| 81 #endif // Request_h | 84 #endif // Request_h |
| OLD | NEW |