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 FetchRequestData_h | 5 #ifndef FetchRequestData_h |
6 #define FetchRequestData_h | 6 #define FetchRequestData_h |
7 | 7 |
| 8 #include "platform/heap/Handle.h" |
8 #include "platform/weborigin/KURL.h" | 9 #include "platform/weborigin/KURL.h" |
9 #include "platform/weborigin/Referrer.h" | 10 #include "platform/weborigin/Referrer.h" |
10 #include "wtf/PassOwnPtr.h" | 11 #include "wtf/PassOwnPtr.h" |
11 #include "wtf/PassRefPtr.h" | 12 #include "wtf/PassRefPtr.h" |
12 #include "wtf/RefCounted.h" | 13 #include "wtf/RefCounted.h" |
13 #include "wtf/text/AtomicString.h" | 14 #include "wtf/text/AtomicString.h" |
14 #include "wtf/text/WTFString.h" | 15 #include "wtf/text/WTFString.h" |
15 | 16 |
16 namespace blink { | 17 namespace blink { |
17 class WebServiceWorkerRequest; | 18 class WebServiceWorkerRequest; |
18 } | 19 } |
19 | 20 |
20 namespace WebCore { | 21 namespace WebCore { |
21 | 22 |
22 class ExecutionContext; | 23 class ExecutionContext; |
23 class FetchHeaderList; | 24 class FetchHeaderList; |
24 struct ResourceLoaderOptions; | 25 struct ResourceLoaderOptions; |
25 class ResourceRequest; | 26 class ResourceRequest; |
26 class SecurityOrigin; | 27 class SecurityOrigin; |
27 struct ThreadableLoaderOptions; | 28 struct ThreadableLoaderOptions; |
28 | 29 |
29 class FetchRequestData : public RefCounted<FetchRequestData> { | 30 class FetchRequestData FINAL : public RefCountedWillBeGarbageCollectedFinalized<
FetchRequestData> { |
30 WTF_MAKE_NONCOPYABLE(FetchRequestData); | 31 WTF_MAKE_NONCOPYABLE(FetchRequestData); |
31 public: | 32 public: |
32 enum Mode { SameOriginMode, NoCORSMode, CORSMode, CORSWithForcedPreflight }; | 33 enum Mode { SameOriginMode, NoCORSMode, CORSMode, CORSWithForcedPreflight }; |
33 enum Credentials { OmitCredentials, SameOriginCredentials, IncludeCredential
s }; | 34 enum Credentials { OmitCredentials, SameOriginCredentials, IncludeCredential
s }; |
34 enum Context { ChildContext, ConnectContext, DownloadContext, FontContext, F
ormContext, ImageContext, ManifestContext, MediaContext, NavigateContext, Object
Context, PingContext, PopupContext, PrefetchContext, ScriptContext, ServiceWorke
rContext, SharedWorkerContext, StyleContext, WorkerContext, NullContext }; | 35 enum Context { ChildContext, ConnectContext, DownloadContext, FontContext, F
ormContext, ImageContext, ManifestContext, MediaContext, NavigateContext, Object
Context, PingContext, PopupContext, PrefetchContext, ScriptContext, ServiceWorke
rContext, SharedWorkerContext, StyleContext, WorkerContext, NullContext }; |
35 enum Tainting { BasicTainting, CORSTainting, OpaqueTainting }; | 36 enum Tainting { BasicTainting, CORSTainting, OpaqueTainting }; |
36 | 37 |
37 class Referrer { | 38 class Referrer { |
38 WTF_MAKE_NONCOPYABLE(Referrer); | 39 WTF_MAKE_NONCOPYABLE(Referrer); |
39 public: | 40 public: |
(...skipping 17 matching lines...) Expand all Loading... |
57 m_referrer = referrer; | 58 m_referrer = referrer; |
58 m_type = URLReferrer; | 59 m_type = URLReferrer; |
59 } | 60 } |
60 WebCore::Referrer referrer() const { return m_referrer; } | 61 WebCore::Referrer referrer() const { return m_referrer; } |
61 private: | 62 private: |
62 enum Type { NoneReferrer, ClientReferrer, URLReferrer }; | 63 enum Type { NoneReferrer, ClientReferrer, URLReferrer }; |
63 Type m_type; | 64 Type m_type; |
64 WebCore::Referrer m_referrer; | 65 WebCore::Referrer m_referrer; |
65 }; | 66 }; |
66 | 67 |
67 static PassRefPtr<FetchRequestData> create(ExecutionContext*); | 68 static PassRefPtrWillBeRawPtr<FetchRequestData> create(ExecutionContext*); |
68 static PassRefPtr<FetchRequestData> create(const blink::WebServiceWorkerRequ
est&); | 69 static PassRefPtrWillBeRawPtr<FetchRequestData> create(const blink::WebServi
ceWorkerRequest&); |
69 PassRefPtr<FetchRequestData> createRestrictedCopy(ExecutionContext*, PassRef
Ptr<SecurityOrigin>) const; | 70 PassRefPtrWillBeRawPtr<FetchRequestData> createRestrictedCopy(ExecutionConte
xt*, PassRefPtr<SecurityOrigin>) const; |
70 ~FetchRequestData(); | 71 ~FetchRequestData(); |
71 | 72 |
72 void setMethod(AtomicString method) { m_method = method; } | 73 void setMethod(AtomicString method) { m_method = method; } |
73 const AtomicString method() const { return m_method; } | 74 const AtomicString method() const { return m_method; } |
74 void setURL(const KURL& url) { m_url = url; } | 75 void setURL(const KURL& url) { m_url = url; } |
75 const KURL& url() const { return m_url; } | 76 const KURL& url() const { return m_url; } |
76 bool unsafeRequestFlag() const { return m_unsafeRequestFlag; } | 77 bool unsafeRequestFlag() const { return m_unsafeRequestFlag; } |
77 PassRefPtr<SecurityOrigin> origin() { return m_origin; } | 78 PassRefPtr<SecurityOrigin> origin() { return m_origin; } |
78 bool sameOriginDataURLFlag() { return m_sameOriginDataURLFlag; } | 79 bool sameOriginDataURLFlag() { return m_sameOriginDataURLFlag; } |
79 const Referrer& referrer() const { return m_referrer; } | 80 const Referrer& referrer() const { return m_referrer; } |
80 void setMode(Mode mode) { m_mode = mode; } | 81 void setMode(Mode mode) { m_mode = mode; } |
81 Mode mode() const { return m_mode; } | 82 Mode mode() const { return m_mode; } |
82 void setCredentials(Credentials credentials) { m_credentials = credentials;
} | 83 void setCredentials(Credentials credentials) { m_credentials = credentials;
} |
83 Credentials credentials() const { return m_credentials; } | 84 Credentials credentials() const { return m_credentials; } |
84 void setResponseTainting(Tainting tainting) { m_responseTainting = tainting;
} | 85 void setResponseTainting(Tainting tainting) { m_responseTainting = tainting;
} |
85 Tainting tainting() const { return m_responseTainting; } | 86 Tainting tainting() const { return m_responseTainting; } |
86 FetchHeaderList* headerList() { return m_headerList.get(); } | 87 FetchHeaderList* headerList() { return m_headerList.get(); } |
87 | 88 |
| 89 void trace(Visitor*); |
| 90 |
88 private: | 91 private: |
89 FetchRequestData(); | 92 FetchRequestData(); |
90 | 93 |
| 94 static PassRefPtrWillBeRawPtr<FetchRequestData> create(); |
| 95 |
91 AtomicString m_method; | 96 AtomicString m_method; |
92 KURL m_url; | 97 KURL m_url; |
93 RefPtr<FetchHeaderList> m_headerList; | 98 RefPtrWillBeMember<FetchHeaderList> m_headerList; |
94 bool m_unsafeRequestFlag; | 99 bool m_unsafeRequestFlag; |
95 // FIXME: Support body. | 100 // FIXME: Support body. |
96 // FIXME: Support m_skipServiceWorkerFlag; | 101 // FIXME: Support m_skipServiceWorkerFlag; |
97 Context m_context; | 102 Context m_context; |
98 RefPtr<SecurityOrigin> m_origin; | 103 RefPtr<SecurityOrigin> m_origin; |
99 // FIXME: Support m_forceOriginHeaderFlag; | 104 // FIXME: Support m_forceOriginHeaderFlag; |
100 bool m_sameOriginDataURLFlag; | 105 bool m_sameOriginDataURLFlag; |
101 Referrer m_referrer; | 106 Referrer m_referrer; |
102 // FIXME: Support m_authenticationFlag; | 107 // FIXME: Support m_authenticationFlag; |
103 // FIXME: Support m_synchronousFlag; | 108 // FIXME: Support m_synchronousFlag; |
104 Mode m_mode; | 109 Mode m_mode; |
105 Credentials m_credentials; | 110 Credentials m_credentials; |
106 // FIXME: Support m_useURLCredentialsFlag; | 111 // FIXME: Support m_useURLCredentialsFlag; |
107 // FIXME: Support m_manualRedirectFlag; | 112 // FIXME: Support m_manualRedirectFlag; |
108 // FIXME: Support m_redirectCount; | 113 // FIXME: Support m_redirectCount; |
109 Tainting m_responseTainting; | 114 Tainting m_responseTainting; |
110 }; | 115 }; |
111 | 116 |
112 } // namespace WebCore | 117 } // namespace WebCore |
113 | 118 |
114 #endif // FetchRequestData_h | 119 #endif // FetchRequestData_h |
OLD | NEW |