| 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" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class WebServiceWorkerRequest; | 23 class WebServiceWorkerRequest; |
| 24 | 24 |
| 25 class FetchRequestData final : public GarbageCollectedFinalized<FetchRequestData
> { | 25 class FetchRequestData final : public GarbageCollectedFinalized<FetchRequestData
> { |
| 26 WTF_MAKE_NONCOPYABLE(FetchRequestData); | 26 WTF_MAKE_NONCOPYABLE(FetchRequestData); |
| 27 public: | 27 public: |
| 28 enum Tainting { BasicTainting, CORSTainting, OpaqueTainting }; | 28 enum Tainting { BasicTainting, CORSTainting, OpaqueTainting }; |
| 29 | 29 |
| 30 class Referrer final { | 30 class Referrer final { |
| 31 public: | 31 public: |
| 32 Referrer() : m_type(ClientReferrer) { } | 32 Referrer() : m_type(ClientReferrer) { } |
| 33 bool isNone() const { return m_type == NoneReferrer; } | 33 bool isNoReferrer() const { return m_type == NoReferrer; } |
| 34 bool isClient() const { return m_type == ClientReferrer; } | 34 bool isClient() const { return m_type == ClientReferrer; } |
| 35 bool isURL() const { return m_type == URLReferrer; } | 35 bool isURL() const { return m_type == URLReferrer; } |
| 36 void setNone() | 36 void setNoReferrer() |
| 37 { | 37 { |
| 38 m_referrer = blink::Referrer(); | 38 m_referrer = blink::Referrer(); |
| 39 m_type = NoneReferrer; | 39 m_type = NoReferrer; |
| 40 } | 40 } |
| 41 void setClient(const blink::Referrer& referrer) | 41 void setClient() |
| 42 { | 42 { |
| 43 m_referrer = referrer; | 43 m_referrer = blink::Referrer(); |
| 44 m_type = ClientReferrer; | 44 m_type = ClientReferrer; |
| 45 } | 45 } |
| 46 void setURL(const blink::Referrer& referrer) | 46 void setURL(const blink::Referrer& referrer) |
| 47 { | 47 { |
| 48 m_referrer = referrer; | 48 m_referrer = referrer; |
| 49 m_type = URLReferrer; | 49 m_type = URLReferrer; |
| 50 } | 50 } |
| 51 blink::Referrer referrer() const { return m_referrer; } | 51 blink::Referrer referrer() const { return m_referrer; } |
| 52 private: | 52 private: |
| 53 enum Type { NoneReferrer, ClientReferrer, URLReferrer }; | 53 enum Type { NoReferrer, ClientReferrer, URLReferrer }; |
| 54 Type m_type; | 54 Type m_type; |
| 55 blink::Referrer m_referrer; | 55 blink::Referrer m_referrer; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 static FetchRequestData* create(ExecutionContext*); | 58 static FetchRequestData* create(); |
| 59 static FetchRequestData* create(const blink::WebServiceWorkerRequest&); | 59 static FetchRequestData* create(const blink::WebServiceWorkerRequest&); |
| 60 FetchRequestData* createRestrictedCopy(ExecutionContext*, PassRefPtr<Securit
yOrigin>) const; | 60 FetchRequestData* createRestrictedCopy(ExecutionContext*, PassRefPtr<Securit
yOrigin>) const; |
| 61 FetchRequestData* createCopy() const; | 61 FetchRequestData* createCopy() const; |
| 62 ~FetchRequestData(); | 62 ~FetchRequestData(); |
| 63 | 63 |
| 64 void setMethod(AtomicString method) { m_method = method; } | 64 void setMethod(AtomicString method) { m_method = method; } |
| 65 const AtomicString method() const { return m_method; } | 65 const AtomicString method() const { return m_method; } |
| 66 void setURL(const KURL& url) { m_url = url; } | 66 void setURL(const KURL& url) { m_url = url; } |
| 67 const KURL& url() const { return m_url; } | 67 const KURL& url() const { return m_url; } |
| 68 bool unsafeRequestFlag() const { return m_unsafeRequestFlag; } | 68 bool unsafeRequestFlag() const { return m_unsafeRequestFlag; } |
| 69 PassRefPtr<SecurityOrigin> origin() { return m_origin; } | 69 PassRefPtr<SecurityOrigin> origin() { return m_origin; } |
| 70 bool sameOriginDataURLFlag() { return m_sameOriginDataURLFlag; } | 70 bool sameOriginDataURLFlag() { return m_sameOriginDataURLFlag; } |
| 71 const Referrer& referrer() const { return m_referrer; } | 71 const Referrer& referrer() const { return m_referrer; } |
| 72 void setMode(WebURLRequest::FetchRequestMode mode) { m_mode = mode; } | 72 void setMode(WebURLRequest::FetchRequestMode mode) { m_mode = mode; } |
| 73 WebURLRequest::FetchRequestMode mode() const { return m_mode; } | 73 WebURLRequest::FetchRequestMode mode() const { return m_mode; } |
| 74 void setCredentials(WebURLRequest::FetchCredentialsMode credentials) { m_cre
dentials = credentials; } | 74 void setCredentials(WebURLRequest::FetchCredentialsMode credentials) { m_cre
dentials = credentials; } |
| 75 WebURLRequest::FetchCredentialsMode credentials() const { return m_credentia
ls; } | 75 WebURLRequest::FetchCredentialsMode credentials() const { return m_credentia
ls; } |
| 76 void setResponseTainting(Tainting tainting) { m_responseTainting = tainting;
} | 76 void setResponseTainting(Tainting tainting) { m_responseTainting = tainting;
} |
| 77 Tainting tainting() const { return m_responseTainting; } | 77 Tainting tainting() const { return m_responseTainting; } |
| 78 FetchHeaderList* headerList() { return m_headerList.get(); } | 78 FetchHeaderList* headerList() { return m_headerList.get(); } |
| 79 PassRefPtr<BlobDataHandle> blobDataHandle() const { return m_blobDataHandle;
} | 79 PassRefPtr<BlobDataHandle> blobDataHandle() const { return m_blobDataHandle;
} |
| 80 void setBlobDataHandle(PassRefPtr<BlobDataHandle> blobHandle) { m_blobDataHa
ndle = blobHandle; } | 80 void setBlobDataHandle(PassRefPtr<BlobDataHandle> blobHandle) { m_blobDataHa
ndle = blobHandle; } |
| 81 | 81 |
| 82 void trace(Visitor*); | 82 void trace(Visitor*); |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 FetchRequestData(); | 85 FetchRequestData(); |
| 86 | 86 |
| 87 static FetchRequestData* create(); | |
| 88 | |
| 89 AtomicString m_method; | 87 AtomicString m_method; |
| 90 KURL m_url; | 88 KURL m_url; |
| 91 Member<FetchHeaderList> m_headerList; | 89 Member<FetchHeaderList> m_headerList; |
| 92 RefPtr<BlobDataHandle> m_blobDataHandle; | 90 RefPtr<BlobDataHandle> m_blobDataHandle; |
| 93 bool m_unsafeRequestFlag; | 91 bool m_unsafeRequestFlag; |
| 94 // FIXME: Support m_skipServiceWorkerFlag; | 92 // FIXME: Support m_skipServiceWorkerFlag; |
| 95 WebURLRequest::RequestContext m_context; | 93 WebURLRequest::RequestContext m_context; |
| 96 RefPtr<SecurityOrigin> m_origin; | 94 RefPtr<SecurityOrigin> m_origin; |
| 97 // FIXME: Support m_forceOriginHeaderFlag; | 95 // FIXME: Support m_forceOriginHeaderFlag; |
| 98 bool m_sameOriginDataURLFlag; | 96 bool m_sameOriginDataURLFlag; |
| 99 Referrer m_referrer; | 97 Referrer m_referrer; |
| 100 // FIXME: Support m_authenticationFlag; | 98 // FIXME: Support m_authenticationFlag; |
| 101 // FIXME: Support m_synchronousFlag; | 99 // FIXME: Support m_synchronousFlag; |
| 102 WebURLRequest::FetchRequestMode m_mode; | 100 WebURLRequest::FetchRequestMode m_mode; |
| 103 WebURLRequest::FetchCredentialsMode m_credentials; | 101 WebURLRequest::FetchCredentialsMode m_credentials; |
| 104 // FIXME: Support m_useURLCredentialsFlag; | 102 // FIXME: Support m_useURLCredentialsFlag; |
| 105 // FIXME: Support m_manualRedirectFlag; | 103 // FIXME: Support m_manualRedirectFlag; |
| 106 // FIXME: Support m_redirectCount; | 104 // FIXME: Support m_redirectCount; |
| 107 Tainting m_responseTainting; | 105 Tainting m_responseTainting; |
| 108 }; | 106 }; |
| 109 | 107 |
| 110 } // namespace blink | 108 } // namespace blink |
| 111 | 109 |
| 112 #endif // FetchRequestData_h | 110 #endif // FetchRequestData_h |
| OLD | NEW |