• 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 Request_h
6 #define Request_h
7 
8 #include "bindings/v8/Dictionary.h"
9 #include "bindings/v8/ScriptWrappable.h"
10 #include "modules/serviceworkers/HeaderMap.h"
11 #include "platform/weborigin/KURL.h"
12 #include "wtf/RefCounted.h"
13 #include "wtf/RefPtr.h"
14 #include "wtf/text/WTFString.h"
15 
16 namespace blink { class WebServiceWorkerRequest; }
17 
18 namespace WebCore {
19 
20 struct RequestInit;
21 class ResourceRequest;
22 
23 class Request FINAL : public ScriptWrappable, public RefCounted<Request> {
24 public:
25     static PassRefPtr<Request> create();
26     static PassRefPtr<Request> create(const Dictionary&);
27     static PassRefPtr<Request> create(const blink::WebServiceWorkerRequest&);
~Request()28     ~Request() { };
29 
30     void setURL(const String& value);
31     void setMethod(const String& value);
32 
url()33     String url() const { return m_url.string(); }
method()34     String method() const { return m_method; }
35     String origin() const;
headers()36     PassRefPtr<HeaderMap> headers() const { return m_headers; }
37 
38     PassOwnPtr<ResourceRequest> createResourceRequest() const;
39 
40 private:
41     explicit Request(const RequestInit&);
42     explicit Request(const blink::WebServiceWorkerRequest&);
43     KURL m_url;
44     String m_method;
45     RefPtr<HeaderMap> m_headers;
46 };
47 
48 } // namespace WebCore
49 
50 #endif // Request_h
51