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

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

Issue 373613004: [ServiceWorker] Make Response class better conformance with the spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incorporated falken's comment 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 FetchResponseData_h
6 #define FetchResponseData_h
7
8 #include "platform/weborigin/KURL.h"
9 #include "wtf/PassRefPtr.h"
10 #include "wtf/RefCounted.h"
11 #include "wtf/text/AtomicString.h"
12
13 namespace blink { class WebServiceWorkerResponse; }
14
15 namespace WebCore {
16
17 class BlobDataHandle;
18 class FetchHeaderList;
19
20 class FetchResponseData : public RefCounted<FetchResponseData> {
tkent 2014/07/08 08:40:23 nit: extra space before {
horo 2014/07/08 09:13:21 Done.
21 WTF_MAKE_NONCOPYABLE(FetchResponseData);
22 public:
23 // "A response has an associated type which is one of basic, CORS, default,
24 // error, and opaque. Unless stated otherwise, it is default."
25 enum Type { BasicType, CORSType, DefaultType, ErrorType, OpaqueType };
26 // "A response can have an associated termination reason which is one of
27 // end-user abort, fatal, and timeout."
28 enum TerminationReason { EndUserAbortTermination, FatalTermination, TimeoutT ermination };
29
30 static PassRefPtr<FetchResponseData> create();
31 static PassRefPtr<FetchResponseData> createNetworkErrorResponse();
32
33 PassRefPtr<FetchResponseData> createBasicFilteredResponse();
34 PassRefPtr<FetchResponseData> createCORSFilteredResponse();
35 PassRefPtr<FetchResponseData> createOpaqueFilteredResponse();
36
37 Type type() const { return m_type; }
38 const KURL& url() const { return m_url; }
39 unsigned short status() const { return m_status; }
40 AtomicString statusMessage() const { return m_statusMessage; }
41 FetchHeaderList* headerList() const { return m_headerList.get(); }
42 PassRefPtr<BlobDataHandle> blobDataHandle() const { return m_blobDataHandle; }
43
44 void setURL(const KURL& url) { m_url = url; }
45 void setStatus(unsigned short status) { m_status = status; }
46 void setStatusMessage(AtomicString statusMessage) { m_statusMessage = status Message; }
47 void setBlobDataHandle(PassRefPtr<BlobDataHandle> blobDataHandle) { m_blobDa taHandle = blobDataHandle; }
48
49 void populateWebServiceWorkerResponse(blink::WebServiceWorkerResponse&);
50
51 private:
52 FetchResponseData(Type, unsigned short, AtomicString);
53
54 Type m_type;
55 OwnPtr<TerminationReason> m_terminationReason;
56 KURL m_url;
57 unsigned short m_status;
58 AtomicString m_statusMessage;
59 RefPtr<FetchHeaderList> m_headerList;
60 RefPtr<BlobDataHandle> m_blobDataHandle;
61 RefPtr<FetchResponseData> m_internalResponse;
62 };
63
64 } // namespace WebCore
65
66 #endif // FetchResponseData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698