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/RequestOrUSVString.h" | 10 #include "bindings/modules/v8/RequestOrUSVString.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 class EncodedFormData; | 24 class EncodedFormData; |
25 class RequestInit; | 25 class RequestInit; |
26 class WebServiceWorkerRequest; | 26 class WebServiceWorkerRequest; |
27 | 27 |
28 using RequestInfo = RequestOrUSVString; | 28 using RequestInfo = RequestOrUSVString; |
29 | 29 |
30 class MODULES_EXPORT Request final : public Body { | 30 class MODULES_EXPORT Request final : public Body { |
31 DEFINE_WRAPPERTYPEINFO(); | 31 DEFINE_WRAPPERTYPEINFO(); |
32 WTF_MAKE_NONCOPYABLE(Request); | 32 WTF_MAKE_NONCOPYABLE(Request); |
33 public: | 33 public: |
| 34 // These "create" function must be called with entering an appropriate |
| 35 // V8 context. |
34 // From Request.idl: | 36 // From Request.idl: |
35 static Request* create(ScriptState*, const RequestInfo&, const Dictionary&,
ExceptionState&); | 37 static Request* create(ScriptState*, const RequestInfo&, const Dictionary&,
ExceptionState&); |
36 | 38 |
37 static Request* create(ScriptState*, const String&, ExceptionState&); | 39 static Request* create(ScriptState*, const String&, ExceptionState&); |
38 static Request* create(ScriptState*, const String&, const Dictionary&, Excep
tionState&); | 40 static Request* create(ScriptState*, const String&, const Dictionary&, Excep
tionState&); |
39 static Request* create(ScriptState*, Request*, ExceptionState&); | 41 static Request* create(ScriptState*, Request*, ExceptionState&); |
40 static Request* create(ScriptState*, Request*, const Dictionary&, ExceptionS
tate&); | 42 static Request* create(ScriptState*, Request*, const Dictionary&, ExceptionS
tate&); |
41 static Request* create(ScriptState*, FetchRequestData*); | 43 static Request* create(ScriptState*, FetchRequestData*); |
42 static Request* create(ScriptState*, const WebServiceWorkerRequest&); | 44 static Request* create(ScriptState*, const WebServiceWorkerRequest&); |
43 | 45 |
44 // From Request.idl: | 46 // From Request.idl: |
45 String method() const; | 47 String method() const; |
46 KURL url() const; | 48 KURL url() const; |
47 Headers* getHeaders() const { return m_headers; } | 49 Headers* getHeaders() const { return m_headers; } |
48 String context() const; | 50 String context() const; |
49 String referrer() const; | 51 String referrer() const; |
50 String referrerPolicy() const; | 52 String referrerPolicy() const; |
51 String mode() const; | 53 String mode() const; |
52 String credentials() const; | 54 String credentials() const; |
53 String redirect() const; | 55 String redirect() const; |
54 String integrity() const; | 56 String integrity() const; |
55 | 57 |
56 // From Request.idl: | 58 // From Request.idl: |
| 59 // This function must be called with entering an appropriate V8 context. |
57 Request* clone(ScriptState*, ExceptionState&); | 60 Request* clone(ScriptState*, ExceptionState&); |
58 | 61 |
59 FetchRequestData* passRequestData(ScriptState*); | 62 FetchRequestData* passRequestData(ScriptState*); |
60 void populateWebServiceWorkerRequest(WebServiceWorkerRequest&) const; | 63 void populateWebServiceWorkerRequest(WebServiceWorkerRequest&) const; |
61 bool hasBody() const; | 64 bool hasBody() const; |
62 BodyStreamBuffer* bodyBuffer() override { return m_request->buffer(); } | 65 BodyStreamBuffer* bodyBuffer() override { return m_request->buffer(); } |
63 const BodyStreamBuffer* bodyBuffer() const override { return m_request->buff
er(); } | 66 const BodyStreamBuffer* bodyBuffer() const override { return m_request->buff
er(); } |
64 PassRefPtr<EncodedFormData> attachedCredential() const { return m_request->a
ttachedCredential(); } | 67 PassRefPtr<EncodedFormData> attachedCredential() const { return m_request->a
ttachedCredential(); } |
65 | 68 |
66 DECLARE_VIRTUAL_TRACE(); | 69 DECLARE_VIRTUAL_TRACE(); |
67 | 70 |
68 private: | 71 private: |
69 Request(ScriptState*, FetchRequestData*, Headers*); | 72 Request(ScriptState*, FetchRequestData*, Headers*); |
70 Request(ScriptState*, FetchRequestData*); | 73 Request(ScriptState*, FetchRequestData*); |
71 Request(ScriptState*, const WebServiceWorkerRequest&); | 74 Request(ScriptState*, const WebServiceWorkerRequest&); |
72 | 75 |
73 const FetchRequestData* request() const { return m_request; } | 76 const FetchRequestData* request() const { return m_request; } |
74 static Request* createRequestWithRequestOrString(ScriptState*, Request*, con
st String&, RequestInit&, ExceptionState&); | 77 static Request* createRequestWithRequestOrString(ScriptState*, Request*, con
st String&, RequestInit&, ExceptionState&); |
75 | 78 |
76 String mimeType() const override; | 79 String mimeType() const override; |
77 void refreshBody(ScriptState*); | 80 void refreshBody(ScriptState*); |
78 | 81 |
79 const Member<FetchRequestData> m_request; | 82 const Member<FetchRequestData> m_request; |
80 const Member<Headers> m_headers; | 83 const Member<Headers> m_headers; |
81 }; | 84 }; |
82 | 85 |
83 } // namespace blink | 86 } // namespace blink |
84 | 87 |
85 #endif // Request_h | 88 #endif // Request_h |
OLD | NEW |