• 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 WebServiceWorkerRequest_h
6 #define WebServiceWorkerRequest_h
7 
8 #include "WebCommon.h"
9 #include "public/platform/WebPrivatePtr.h"
10 #include "public/platform/WebReferrerPolicy.h"
11 #include "public/platform/WebString.h"
12 #include "public/platform/WebURL.h"
13 
14 #if INSIDE_BLINK
15 #include "platform/network/HTTPHeaderMap.h"
16 #include "platform/weborigin/Referrer.h"
17 #include "wtf/Forward.h"
18 #include "wtf/text/StringHash.h"
19 #include <utility>
20 #endif
21 
22 namespace blink {
23 
24 class BlobDataHandle;
25 class WebHTTPHeaderVisitor;
26 class WebServiceWorkerRequestPrivate;
27 
28 // Represents a request for a web resource.
29 class BLINK_PLATFORM_EXPORT WebServiceWorkerRequest {
30 public:
~WebServiceWorkerRequest()31     ~WebServiceWorkerRequest() { reset(); }
32     WebServiceWorkerRequest();
WebServiceWorkerRequest(const WebServiceWorkerRequest & other)33     WebServiceWorkerRequest(const WebServiceWorkerRequest& other) { assign(other); }
34     WebServiceWorkerRequest& operator=(const WebServiceWorkerRequest& other)
35     {
36         assign(other);
37         return *this;
38     }
39 
40     void reset();
41     void assign(const WebServiceWorkerRequest&);
42 
43     void setURL(const WebURL&);
44     WebURL url() const;
45 
46     void setMethod(const WebString&);
47     WebString method() const;
48 
49     void setHeader(const WebString& key, const WebString& value);
50 
51     // If the key already exists, the value is appended to the existing value
52     // with a comma delimiter between them.
53     void appendHeader(const WebString& key, const WebString& value);
54 
55     void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) const;
56 
57     void setBlob(const WebString& uuid, long long size);
58 
59     void setReferrer(const WebString&, WebReferrerPolicy);
60     WebURL referrerUrl() const;
61     WebReferrerPolicy referrerPolicy() const;
62 
63     void setIsReload(bool);
64     bool isReload() const;
65 
66 #if INSIDE_BLINK
67     const HTTPHeaderMap& headers() const;
68     PassRefPtr<BlobDataHandle> blobDataHandle() const;
69     const Referrer& referrer() const;
70 #endif
71 
72 private:
73     WebPrivatePtr<WebServiceWorkerRequestPrivate> m_private;
74 };
75 
76 } // namespace blink
77 
78 #endif // WebServiceWorkerRequest_h
79