• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 Response_h
6 #define Response_h
7 
8 #include "bindings/v8/Dictionary.h"
9 #include "bindings/v8/ScriptWrappable.h"
10 #include "modules/serviceworkers/HeaderMap.h"
11 #include "platform/blob/BlobData.h"
12 #include "wtf/RefCounted.h"
13 #include "wtf/RefPtr.h"
14 #include "wtf/text/WTFString.h"
15 
16 namespace blink { class WebServiceWorkerResponse; }
17 
18 namespace WebCore {
19 
20 class Blob;
21 struct ResponseInit;
22 
23 class Response FINAL : public ScriptWrappable, public RefCounted<Response> {
24 public:
25     static PassRefPtr<Response> create(Blob* body, const Dictionary& responseInit);
~Response()26     ~Response() { };
27 
status()28     unsigned short status() const { return m_status; }
setStatus(unsigned short value)29     void setStatus(unsigned short value) { m_status = value; }
30 
statusText()31     String statusText() const { return m_statusText; }
setStatusText(const String & value)32     void setStatusText(const String& value) { m_statusText = value; }
33 
34     PassRefPtr<HeaderMap> headers() const;
35 
36     void populateWebServiceWorkerResponse(blink::WebServiceWorkerResponse&);
37 
38 private:
39     Response(PassRefPtr<BlobDataHandle>, const ResponseInit&);
40     unsigned short m_status;
41     String m_statusText;
42     RefPtr<HeaderMap> m_headers;
43     RefPtr<BlobDataHandle> m_blobDataHandle;
44 };
45 
46 } // namespace WebCore
47 
48 #endif // Response_h
49