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() { } | |
30 static Request* create(ExecutionContext*, const String&, ExceptionState&); | 29 static Request* create(ExecutionContext*, const String&, ExceptionState&); |
31 static Request* create(ExecutionContext*, const String&, const Dictionary&,
ExceptionState&); | 30 static Request* create(ExecutionContext*, const String&, const Dictionary&,
ExceptionState&); |
32 static Request* create(ExecutionContext*, Request*, ExceptionState&); | 31 static Request* create(ExecutionContext*, Request*, ExceptionState&); |
33 static Request* create(ExecutionContext*, Request*, const Dictionary&, Excep
tionState&); | 32 static Request* create(ExecutionContext*, Request*, const Dictionary&, Excep
tionState&); |
34 static Request* create(ExecutionContext*, FetchRequestData*); | 33 static Request* create(ExecutionContext*, FetchRequestData*); |
35 static Request* create(ExecutionContext*, const WebServiceWorkerRequest&); | 34 static Request* create(ExecutionContext*, const WebServiceWorkerRequest&); |
36 | 35 |
| 36 const FetchRequestData* request() const { return m_request; } |
37 FetchRequestData* request() { return m_request; } | 37 FetchRequestData* request() { return m_request; } |
38 | 38 |
39 String method() const; | 39 String method() const; |
40 String url() const; | 40 String url() const; |
41 Headers* headers() const { return m_headers; } | 41 Headers* headers() const { return m_headers; } |
42 String referrer() const; | 42 String referrer() const; |
43 String mode() const; | 43 String mode() const; |
44 String credentials() const; | 44 String credentials() const; |
45 | 45 |
46 void populateWebServiceWorkerRequest(WebServiceWorkerRequest&); | 46 void populateWebServiceWorkerRequest(WebServiceWorkerRequest&) const; |
47 | 47 |
48 void setBodyBlobHandle(PassRefPtr<BlobDataHandle>); | 48 void setBodyBlobHandle(PassRefPtr<BlobDataHandle>); |
49 | 49 |
50 virtual void trace(Visitor*) OVERRIDE; | 50 virtual void trace(Visitor*) OVERRIDE; |
51 | 51 |
52 private: | 52 private: |
53 Request(ExecutionContext*, FetchRequestData*); | 53 Request(ExecutionContext*, FetchRequestData*); |
54 Request(ExecutionContext*, const WebServiceWorkerRequest&); | 54 Request(ExecutionContext*, const WebServiceWorkerRequest&); |
55 | 55 |
56 virtual PassRefPtr<BlobDataHandle> blobDataHandle() OVERRIDE; | 56 virtual PassRefPtr<BlobDataHandle> blobDataHandle() OVERRIDE; |
57 | 57 |
58 Member<FetchRequestData> m_request; | 58 Member<FetchRequestData> m_request; |
59 Member<Headers> m_headers; | 59 Member<Headers> m_headers; |
60 }; | 60 }; |
61 | 61 |
62 } // namespace blink | 62 } // namespace blink |
63 | 63 |
64 #endif // Request_h | 64 #endif // Request_h |
OLD | NEW |