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/heap/Handle.h" |
9 #include "platform/weborigin/KURL.h" | 9 #include "platform/weborigin/KURL.h" |
10 #include "platform/weborigin/Referrer.h" | 10 #include "platform/weborigin/Referrer.h" |
| 11 #include "public/platform/WebURLRequest.h" |
11 #include "wtf/PassOwnPtr.h" | 12 #include "wtf/PassOwnPtr.h" |
12 #include "wtf/PassRefPtr.h" | 13 #include "wtf/PassRefPtr.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 | 18 |
18 class BlobDataHandle; | 19 class BlobDataHandle; |
19 class ExecutionContext; | 20 class ExecutionContext; |
20 class FetchHeaderList; | 21 class FetchHeaderList; |
21 class SecurityOrigin; | 22 class SecurityOrigin; |
22 class WebServiceWorkerRequest; | 23 class WebServiceWorkerRequest; |
23 | 24 |
24 class FetchRequestData final : public GarbageCollectedFinalized<FetchRequestData
> { | 25 class FetchRequestData final : public GarbageCollectedFinalized<FetchRequestData
> { |
25 WTF_MAKE_NONCOPYABLE(FetchRequestData); | 26 WTF_MAKE_NONCOPYABLE(FetchRequestData); |
26 public: | 27 public: |
27 enum Mode { SameOriginMode, NoCORSMode, CORSMode, CORSWithForcedPreflight }; | |
28 enum Credentials { OmitCredentials, SameOriginCredentials, IncludeCredential
s }; | |
29 enum Context { ChildContext, ConnectContext, DownloadContext, FontContext, F
ormContext, ImageContext, ManifestContext, MediaContext, NavigateContext, Object
Context, PingContext, PopupContext, PrefetchContext, ScriptContext, ServiceWorke
rContext, SharedWorkerContext, StyleContext, WorkerContext, NullContext }; | 28 enum Context { ChildContext, ConnectContext, DownloadContext, FontContext, F
ormContext, ImageContext, ManifestContext, MediaContext, NavigateContext, Object
Context, PingContext, PopupContext, PrefetchContext, ScriptContext, ServiceWorke
rContext, SharedWorkerContext, StyleContext, WorkerContext, NullContext }; |
30 enum Tainting { BasicTainting, CORSTainting, OpaqueTainting }; | 29 enum Tainting { BasicTainting, CORSTainting, OpaqueTainting }; |
31 | 30 |
32 class Referrer final { | 31 class Referrer final { |
33 public: | 32 public: |
34 Referrer() : m_type(ClientReferrer) { } | 33 Referrer() : m_type(ClientReferrer) { } |
35 bool isNone() const { return m_type == NoneReferrer; } | 34 bool isNone() const { return m_type == NoneReferrer; } |
36 bool isClient() const { return m_type == ClientReferrer; } | 35 bool isClient() const { return m_type == ClientReferrer; } |
37 bool isURL() const { return m_type == URLReferrer; } | 36 bool isURL() const { return m_type == URLReferrer; } |
38 void setNone() | 37 void setNone() |
(...skipping 25 matching lines...) Expand all Loading... |
64 ~FetchRequestData(); | 63 ~FetchRequestData(); |
65 | 64 |
66 void setMethod(AtomicString method) { m_method = method; } | 65 void setMethod(AtomicString method) { m_method = method; } |
67 const AtomicString method() const { return m_method; } | 66 const AtomicString method() const { return m_method; } |
68 void setURL(const KURL& url) { m_url = url; } | 67 void setURL(const KURL& url) { m_url = url; } |
69 const KURL& url() const { return m_url; } | 68 const KURL& url() const { return m_url; } |
70 bool unsafeRequestFlag() const { return m_unsafeRequestFlag; } | 69 bool unsafeRequestFlag() const { return m_unsafeRequestFlag; } |
71 PassRefPtr<SecurityOrigin> origin() { return m_origin; } | 70 PassRefPtr<SecurityOrigin> origin() { return m_origin; } |
72 bool sameOriginDataURLFlag() { return m_sameOriginDataURLFlag; } | 71 bool sameOriginDataURLFlag() { return m_sameOriginDataURLFlag; } |
73 const Referrer& referrer() const { return m_referrer; } | 72 const Referrer& referrer() const { return m_referrer; } |
74 void setMode(Mode mode) { m_mode = mode; } | 73 void setMode(WebURLRequest::FetchRequestMode mode) { m_mode = mode; } |
75 Mode mode() const { return m_mode; } | 74 WebURLRequest::FetchRequestMode mode() const { return m_mode; } |
76 void setCredentials(Credentials credentials) { m_credentials = credentials;
} | 75 void setCredentials(WebURLRequest::FetchCredentialsMode credentials) { m_cre
dentials = credentials; } |
77 Credentials credentials() const { return m_credentials; } | 76 WebURLRequest::FetchCredentialsMode credentials() const { return m_credentia
ls; } |
78 void setResponseTainting(Tainting tainting) { m_responseTainting = tainting;
} | 77 void setResponseTainting(Tainting tainting) { m_responseTainting = tainting;
} |
79 Tainting tainting() const { return m_responseTainting; } | 78 Tainting tainting() const { return m_responseTainting; } |
80 FetchHeaderList* headerList() { return m_headerList.get(); } | 79 FetchHeaderList* headerList() { return m_headerList.get(); } |
81 PassRefPtr<BlobDataHandle> blobDataHandle() const { return m_blobDataHandle;
} | 80 PassRefPtr<BlobDataHandle> blobDataHandle() const { return m_blobDataHandle;
} |
82 void setBlobDataHandle(PassRefPtr<BlobDataHandle> blobHandle) { m_blobDataHa
ndle = blobHandle; } | 81 void setBlobDataHandle(PassRefPtr<BlobDataHandle> blobHandle) { m_blobDataHa
ndle = blobHandle; } |
83 | 82 |
84 void trace(Visitor*); | 83 void trace(Visitor*); |
85 | 84 |
86 private: | 85 private: |
87 FetchRequestData(); | 86 FetchRequestData(); |
88 | 87 |
89 static FetchRequestData* create(); | 88 static FetchRequestData* create(); |
90 | 89 |
91 AtomicString m_method; | 90 AtomicString m_method; |
92 KURL m_url; | 91 KURL m_url; |
93 Member<FetchHeaderList> m_headerList; | 92 Member<FetchHeaderList> m_headerList; |
94 RefPtr<BlobDataHandle> m_blobDataHandle; | 93 RefPtr<BlobDataHandle> m_blobDataHandle; |
95 bool m_unsafeRequestFlag; | 94 bool m_unsafeRequestFlag; |
96 // FIXME: Support m_skipServiceWorkerFlag; | 95 // FIXME: Support m_skipServiceWorkerFlag; |
97 Context m_context; | 96 Context m_context; |
98 RefPtr<SecurityOrigin> m_origin; | 97 RefPtr<SecurityOrigin> m_origin; |
99 // FIXME: Support m_forceOriginHeaderFlag; | 98 // FIXME: Support m_forceOriginHeaderFlag; |
100 bool m_sameOriginDataURLFlag; | 99 bool m_sameOriginDataURLFlag; |
101 Referrer m_referrer; | 100 Referrer m_referrer; |
102 // FIXME: Support m_authenticationFlag; | 101 // FIXME: Support m_authenticationFlag; |
103 // FIXME: Support m_synchronousFlag; | 102 // FIXME: Support m_synchronousFlag; |
104 Mode m_mode; | 103 WebURLRequest::FetchRequestMode m_mode; |
105 Credentials m_credentials; | 104 WebURLRequest::FetchCredentialsMode m_credentials; |
106 // FIXME: Support m_useURLCredentialsFlag; | 105 // FIXME: Support m_useURLCredentialsFlag; |
107 // FIXME: Support m_manualRedirectFlag; | 106 // FIXME: Support m_manualRedirectFlag; |
108 // FIXME: Support m_redirectCount; | 107 // FIXME: Support m_redirectCount; |
109 Tainting m_responseTainting; | 108 Tainting m_responseTainting; |
110 }; | 109 }; |
111 | 110 |
112 } // namespace blink | 111 } // namespace blink |
113 | 112 |
114 #endif // FetchRequestData_h | 113 #endif // FetchRequestData_h |
OLD | NEW |