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

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

Issue 329853012: [ServiceWorker] Make Request class better conformance with the spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 months 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/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, N ullMode };
yhirano 2014/07/02 01:53:07 Do we need NullMode? NullMode can't be set as a va
horo 2014/07/02 03:33:04 deleted
31 enum Credentials { OmitCredentials, SameOriginCredentials, IncludeCredential s, NullCredentials };
yhirano 2014/07/02 01:53:06 ditto
horo 2014/07/02 03:33:04 deleted
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(bool, PassRefPtr<SecurityO rigin>) 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 bool m_clientIsServiceWorker;
86 // FIXME: Support m_skipServiceWorkerFlag;
87 Context m_context;
88 RefPtr<SecurityOrigin> m_origin;
89 // FIXME: Support m_forceOriginHeaderFlag;
90 bool m_sameOriginDataURLFlag;
91 Referrer m_referrer;
92 // FIXME: Support m_authenticationFlag;
93 // FIXME: Support m_synchronousFlag;
94 Mode m_mode;
95 Credentials m_credentials;
96 // FIXME: Support m_useURLCredentialsFlag;
97 // FIXME: Support m_manualRedirectFlag;
98 // FIXME: Support m_redirectCount;
99 Tainting m_responseTainting;
100 };
101
102 } // namespace WebCore
103
104 #endif // FetchRequestData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698