| 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 "modules/serviceworkers/Body.h" | 10 #include "modules/serviceworkers/Body.h" |
| 11 #include "modules/serviceworkers/FetchRequestData.h" | 11 #include "modules/serviceworkers/FetchRequestData.h" |
| 12 #include "modules/serviceworkers/Headers.h" | 12 #include "modules/serviceworkers/Headers.h" |
| 13 #include "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
| 14 #include "platform/weborigin/KURL.h" | 14 #include "platform/weborigin/KURL.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 RequestInit; | 20 class RequestInit; |
| 21 struct ResourceLoaderOptions; | 21 struct ResourceLoaderOptions; |
| 22 class ResourceRequest; | 22 class ResourceRequest; |
| 23 struct ThreadableLoaderOptions; | 23 struct ThreadableLoaderOptions; |
| 24 class WebServiceWorkerRequest; | 24 class WebServiceWorkerRequest; |
| 25 | 25 |
| 26 class Request FINAL : public Body { | 26 class Request final : public Body { |
| 27 DEFINE_WRAPPERTYPEINFO(); | 27 DEFINE_WRAPPERTYPEINFO(); |
| 28 public: | 28 public: |
| 29 virtual ~Request() { } | 29 virtual ~Request() { } |
| 30 static Request* create(ExecutionContext*, const String&, ExceptionState&); | 30 static Request* create(ExecutionContext*, const String&, ExceptionState&); |
| 31 static Request* create(ExecutionContext*, const String&, const Dictionary&,
ExceptionState&); | 31 static Request* create(ExecutionContext*, const String&, const Dictionary&,
ExceptionState&); |
| 32 static Request* create(ExecutionContext*, Request*, ExceptionState&); | 32 static Request* create(ExecutionContext*, Request*, ExceptionState&); |
| 33 static Request* create(ExecutionContext*, Request*, const Dictionary&, Excep
tionState&); | 33 static Request* create(ExecutionContext*, Request*, const Dictionary&, Excep
tionState&); |
| 34 static Request* create(ExecutionContext*, FetchRequestData*); | 34 static Request* create(ExecutionContext*, FetchRequestData*); |
| 35 static Request* create(ExecutionContext*, const WebServiceWorkerRequest&); | 35 static Request* create(ExecutionContext*, const WebServiceWorkerRequest&); |
| 36 // The 'FetchRequestData' object is shared between requests, as it is | 36 // The 'FetchRequestData' object is shared between requests, as it is |
| 37 // immutable to the user after Request creation. Headers are copied. | 37 // immutable to the user after Request creation. Headers are copied. |
| 38 static Request* create(const Request&); | 38 static Request* create(const Request&); |
| 39 | 39 |
| 40 const FetchRequestData* request() { return m_request; } | 40 const FetchRequestData* request() { return m_request; } |
| 41 | 41 |
| 42 String method() const; | 42 String method() const; |
| 43 String url() const; | 43 String url() const; |
| 44 Headers* headers() const { return m_headers; } | 44 Headers* headers() const { return m_headers; } |
| 45 String referrer() const; | 45 String referrer() const; |
| 46 String mode() const; | 46 String mode() const; |
| 47 String credentials() const; | 47 String credentials() const; |
| 48 | 48 |
| 49 Request* clone() const; | 49 Request* clone() const; |
| 50 | 50 |
| 51 void populateWebServiceWorkerRequest(WebServiceWorkerRequest&); | 51 void populateWebServiceWorkerRequest(WebServiceWorkerRequest&); |
| 52 | 52 |
| 53 void setBodyBlobHandle(PassRefPtr<BlobDataHandle>); | 53 void setBodyBlobHandle(PassRefPtr<BlobDataHandle>); |
| 54 | 54 |
| 55 virtual void trace(Visitor*) OVERRIDE; | 55 virtual void trace(Visitor*) override; |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 explicit Request(const Request&); | 58 explicit Request(const Request&); |
| 59 Request(ExecutionContext*, FetchRequestData*); | 59 Request(ExecutionContext*, FetchRequestData*); |
| 60 Request(ExecutionContext*, const WebServiceWorkerRequest&); | 60 Request(ExecutionContext*, const WebServiceWorkerRequest&); |
| 61 | 61 |
| 62 static Request* createRequestWithRequestData(ExecutionContext*, FetchRequest
Data*, const RequestInit&, FetchRequestData::Mode, FetchRequestData::Credentials
, ExceptionState&); | 62 static Request* createRequestWithRequestData(ExecutionContext*, FetchRequest
Data*, const RequestInit&, FetchRequestData::Mode, FetchRequestData::Credentials
, ExceptionState&); |
| 63 void clearHeaderList(); | 63 void clearHeaderList(); |
| 64 | 64 |
| 65 virtual PassRefPtr<BlobDataHandle> blobDataHandle() OVERRIDE; | 65 virtual PassRefPtr<BlobDataHandle> blobDataHandle() override; |
| 66 | 66 |
| 67 const Member<FetchRequestData> m_request; | 67 const Member<FetchRequestData> m_request; |
| 68 const Member<Headers> m_headers; | 68 const Member<Headers> m_headers; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 } // namespace blink | 71 } // namespace blink |
| 72 | 72 |
| 73 #endif // Request_h | 73 #endif // Request_h |
| OLD | NEW |