Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(637)

Side by Side Diff: Source/modules/serviceworkers/FetchRequestData.h

Issue 795323003: Move Fetch API releted code to modules/fetch. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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/heap/Handle.h"
9 #include "platform/weborigin/KURL.h"
10 #include "platform/weborigin/Referrer.h"
11 #include "public/platform/WebURLRequest.h"
12 #include "wtf/PassOwnPtr.h"
13 #include "wtf/PassRefPtr.h"
14 #include "wtf/text/AtomicString.h"
15 #include "wtf/text/WTFString.h"
16
17 namespace blink {
18
19 class BlobDataHandle;
20 class ExecutionContext;
21 class FetchHeaderList;
22 class SecurityOrigin;
23 class WebServiceWorkerRequest;
24
25 class FetchRequestData final : public GarbageCollectedFinalized<FetchRequestData > {
26 WTF_MAKE_NONCOPYABLE(FetchRequestData);
27 public:
28 enum Tainting { BasicTainting, CORSTainting, OpaqueTainting };
29
30 class Referrer final {
31 public:
32 Referrer() : m_type(ClientReferrer) { }
33 bool isNoReferrer() const { return m_type == NoReferrer; }
34 bool isClient() const { return m_type == ClientReferrer; }
35 bool isURL() const { return m_type == URLReferrer; }
36 void setNoReferrer()
37 {
38 m_referrer = blink::Referrer();
39 m_type = NoReferrer;
40 }
41 void setClient()
42 {
43 m_referrer = blink::Referrer();
44 m_type = ClientReferrer;
45 }
46 void setURL(const blink::Referrer& referrer)
47 {
48 m_referrer = referrer;
49 m_type = URLReferrer;
50 }
51 blink::Referrer referrer() const { return m_referrer; }
52 private:
53 enum Type { NoReferrer, ClientReferrer, URLReferrer };
54 Type m_type;
55 blink::Referrer m_referrer;
56 };
57
58 static FetchRequestData* create();
59 static FetchRequestData* create(const blink::WebServiceWorkerRequest&);
60 FetchRequestData* createCopy() const;
61 ~FetchRequestData();
62
63 void setMethod(AtomicString method) { m_method = method; }
64 const AtomicString method() const { return m_method; }
65 void setURL(const KURL& url) { m_url = url; }
66 const KURL& url() const { return m_url; }
67 bool unsafeRequestFlag() const { return m_unsafeRequestFlag; }
68 void setUnsafeRequestFlag(bool flag) { m_unsafeRequestFlag = flag; }
69 WebURLRequest::RequestContext context() const { return m_context; }
70 void setContext(WebURLRequest::RequestContext context) { m_context = context ; }
71 PassRefPtr<SecurityOrigin> origin() { return m_origin; }
72 void setOrigin(PassRefPtr<SecurityOrigin> origin) { m_origin = origin; }
73 bool sameOriginDataURLFlag() { return m_sameOriginDataURLFlag; }
74 void setSameOriginDataURLFlag(bool flag) { m_sameOriginDataURLFlag = flag; }
75 const Referrer& referrer() const { return m_referrer; }
76 Referrer* mutableReferrer() { return &m_referrer; }
77 void setMode(WebURLRequest::FetchRequestMode mode) { m_mode = mode; }
78 WebURLRequest::FetchRequestMode mode() const { return m_mode; }
79 void setCredentials(WebURLRequest::FetchCredentialsMode credentials) { m_cre dentials = credentials; }
80 WebURLRequest::FetchCredentialsMode credentials() const { return m_credentia ls; }
81 void setResponseTainting(Tainting tainting) { m_responseTainting = tainting; }
82 Tainting tainting() const { return m_responseTainting; }
83 FetchHeaderList* headerList() const { return m_headerList.get(); }
84 void setHeaderList(FetchHeaderList* headerList) { m_headerList = headerList; }
85 PassRefPtr<BlobDataHandle> blobDataHandle() const { return m_blobDataHandle; }
86 void setBlobDataHandle(PassRefPtr<BlobDataHandle> blobHandle) { m_blobDataHa ndle = blobHandle; }
87
88 void trace(Visitor*);
89
90 private:
91 FetchRequestData();
92
93 AtomicString m_method;
94 KURL m_url;
95 Member<FetchHeaderList> m_headerList;
96 RefPtr<BlobDataHandle> m_blobDataHandle;
97 bool m_unsafeRequestFlag;
98 // FIXME: Support m_skipServiceWorkerFlag;
99 WebURLRequest::RequestContext m_context;
100 RefPtr<SecurityOrigin> m_origin;
101 // FIXME: Support m_forceOriginHeaderFlag;
102 bool m_sameOriginDataURLFlag;
103 Referrer m_referrer;
104 // FIXME: Support m_authenticationFlag;
105 // FIXME: Support m_synchronousFlag;
106 WebURLRequest::FetchRequestMode m_mode;
107 WebURLRequest::FetchCredentialsMode m_credentials;
108 // FIXME: Support m_useURLCredentialsFlag;
109 // FIXME: Support m_manualRedirectFlag;
110 // FIXME: Support m_redirectCount;
111 Tainting m_responseTainting;
112 };
113
114 } // namespace blink
115
116 #endif // FetchRequestData_h
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/FetchManager.cpp ('k') | Source/modules/serviceworkers/FetchRequestData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698