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

Side by Side Diff: Source/modules/serviceworkers/Response.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: 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
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 Response_h 5 #ifndef Response_h
6 #define Response_h 6 #define Response_h
7 7
8 #include "bindings/core/v8/Dictionary.h" 8 #include "bindings/core/v8/Dictionary.h"
9 #include "bindings/core/v8/ScriptWrappable.h" 9 #include "bindings/core/v8/ScriptWrappable.h"
10 #include "modules/serviceworkers/HeaderMap.h" 10 #include "modules/serviceworkers/FetchResponseData.h"
11 #include "modules/serviceworkers/Headers.h"
11 #include "platform/blob/BlobData.h" 12 #include "platform/blob/BlobData.h"
12 #include "wtf/RefCounted.h" 13 #include "wtf/RefCounted.h"
13 #include "wtf/RefPtr.h" 14 #include "wtf/RefPtr.h"
14 #include "wtf/text/WTFString.h" 15 #include "wtf/text/WTFString.h"
15 16
16 namespace blink { class WebServiceWorkerResponse; } 17 namespace blink { class WebServiceWorkerResponse; }
17 18
18 namespace WebCore { 19 namespace WebCore {
19 20
20 class Blob; 21 class Blob;
22 class ExceptionState;
21 struct ResponseInit; 23 struct ResponseInit;
22 24
23 class Response FINAL : public ScriptWrappable, public RefCounted<Response> { 25 class Response FINAL : public ScriptWrappable, public RefCounted<Response> {
24 public: 26 public:
25 static PassRefPtr<Response> create(Blob*, const Dictionary&); 27 static PassRefPtr<Response> create(Blob*, const Dictionary&, ExceptionState& );
26 static PassRefPtr<Response> create(Blob*, const ResponseInit&); 28 static PassRefPtr<Response> create(Blob*, const ResponseInit&, ExceptionStat e&);
29
30 static PassRefPtr<Response> create(PassRefPtr<FetchResponseData>);
27 ~Response() { }; 31 ~Response() { };
28 32
29 unsigned short status() const { return m_status; } 33 String type() const;
30 void setStatus(unsigned short value) { m_status = value; } 34 String url() const;
31 35 unsigned short status() const;
32 String statusText() const { return m_statusText; } 36 String statusText() const;
33 void setStatusText(const String& value) { m_statusText = value; } 37 PassRefPtr<Headers> headers() const;
34
35 PassRefPtr<HeaderMap> headers() const;
36 38
37 void populateWebServiceWorkerResponse(blink::WebServiceWorkerResponse&); 39 void populateWebServiceWorkerResponse(blink::WebServiceWorkerResponse&);
38 40
39 private: 41 private:
40 Response(PassRefPtr<BlobDataHandle>, const ResponseInit&); 42 Response();
41 unsigned short m_status; 43 Response(PassRefPtr<FetchResponseData>);
42 String m_statusText; 44
43 RefPtr<HeaderMap> m_headers; 45 RefPtr<FetchResponseData> m_response;
44 RefPtr<BlobDataHandle> m_blobDataHandle; 46 RefPtr<Headers> m_headers;
47 // FIXME: Support FetchBodyStream.
45 }; 48 };
46 49
47 } // namespace WebCore 50 } // namespace WebCore
48 51
49 #endif // Response_h 52 #endif // Response_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698