OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef FetchRequestData_h |
| 6 #define FetchRequestData_h |
| 7 |
| 8 #include "platform/weborigin/KURL.h" |
| 9 #include "wtf/PassOwnPtr.h" |
| 10 #include "wtf/PassRefPtr.h" |
| 11 #include "wtf/RefCounted.h" |
| 12 #include "wtf/text/AtomicString.h" |
| 13 #include "wtf/text/WTFString.h" |
| 14 |
| 15 namespace blink { |
| 16 class WebServiceWorkerRequest; |
| 17 } |
| 18 |
| 19 namespace WebCore { |
| 20 |
| 21 class FetchHeaderList; |
| 22 struct ResourceLoaderOptions; |
| 23 class ResourceRequest; |
| 24 class SecurityOrigin; |
| 25 struct ThreadableLoaderOptions; |
| 26 |
| 27 |
| 28 class FetchRequestData : public RefCounted<FetchRequestData> { |
| 29 public: |
| 30 enum Mode { SameOriginMode, NoCORSMode, CORSMode, CORSWithForcedPreflight }; |
| 31 enum Credentials { OmitCredentials, SameOriginCredentials, IncludeCredential
s }; |
| 32 enum Context { ChildContext, ConnectContext, DownloadContext, FontContext, F
ormContext, ImageContext, ManifestContext, MediaContext, NavigateContext, Object
Context, PingContext, PopupContext, PrefetchContext, ScriptContext, ServiceWorke
rContext, SharedWorkerContext, StyleContext, WorkerContext, NullContext }; |
| 33 enum Tainting { BasicTainting, CORSTainting, OpaqueTainting }; |
| 34 |
| 35 class Referrer { |
| 36 public: |
| 37 Referrer() : m_type(ClientReferrer) { } |
| 38 ~Referrer() { } |
| 39 bool isNone() const { return m_type == NoneReferrer; } |
| 40 bool isClient() const { return m_type == ClientReferrer; } |
| 41 bool isURL() const { return m_type == URLReferrer; } |
| 42 void setNone() { m_referrerURL = ""; m_type = NoneReferrer; } |
| 43 void setClient() { m_referrerURL = ""; m_type = ClientReferrer; } |
| 44 void setURL(const String& url) |
| 45 { |
| 46 m_referrerURL = url; |
| 47 m_type = URLReferrer; |
| 48 } |
| 49 String getUrl() const { return m_referrerURL; } |
| 50 private: |
| 51 enum Type { NoneReferrer, ClientReferrer, URLReferrer }; |
| 52 Type m_type; |
| 53 String m_referrerURL; |
| 54 }; |
| 55 |
| 56 static PassRefPtr<FetchRequestData> create(); |
| 57 static PassRefPtr<FetchRequestData> create(const blink::WebServiceWorkerRequ
est&); |
| 58 PassRefPtr<FetchRequestData> createRestrictedCopy(PassRefPtr<SecurityOrigin>
) const; |
| 59 ~FetchRequestData(); |
| 60 |
| 61 void setMethod(AtomicString method) { m_method = method; } |
| 62 const AtomicString method() const { return m_method; } |
| 63 void setURL(const KURL& url) { m_url = url; } |
| 64 const KURL& url() const { return m_url; } |
| 65 bool unsafeRequestFlag() const { return m_unsafeRequestFlag; } |
| 66 PassRefPtr<SecurityOrigin> origin() { return m_origin; } |
| 67 bool sameOriginDataURLFlag() { return m_sameOriginDataURLFlag; } |
| 68 const Referrer& referrer() const { return m_referrer; } |
| 69 void setMode(Mode mode) { m_mode = mode; } |
| 70 Mode mode() const { return m_mode; } |
| 71 void setCredentials(Credentials credentials) { m_credentials = credentials;
} |
| 72 Credentials credentials() const { return m_credentials; } |
| 73 void setResponseTainting(Tainting tainting) { m_responseTainting = tainting;
} |
| 74 Tainting tainting() const { return m_responseTainting; } |
| 75 FetchHeaderList* headerList() { return m_headerList.get(); } |
| 76 |
| 77 private: |
| 78 FetchRequestData(); |
| 79 |
| 80 AtomicString m_method; |
| 81 KURL m_url; |
| 82 RefPtr<FetchHeaderList> m_headerList; |
| 83 bool m_unsafeRequestFlag; |
| 84 // FIXME: Support body. |
| 85 // FIXME: Support m_skipServiceWorkerFlag; |
| 86 Context m_context; |
| 87 RefPtr<SecurityOrigin> m_origin; |
| 88 // FIXME: Support m_forceOriginHeaderFlag; |
| 89 bool m_sameOriginDataURLFlag; |
| 90 Referrer m_referrer; |
| 91 // FIXME: Support m_authenticationFlag; |
| 92 // FIXME: Support m_synchronousFlag; |
| 93 Mode m_mode; |
| 94 Credentials m_credentials; |
| 95 // FIXME: Support m_useURLCredentialsFlag; |
| 96 // FIXME: Support m_manualRedirectFlag; |
| 97 // FIXME: Support m_redirectCount; |
| 98 Tainting m_responseTainting; |
| 99 }; |
| 100 |
| 101 } // namespace WebCore |
| 102 |
| 103 #endif // FetchRequestData_h |
OLD | NEW |