Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / public / platform / modules / serviceworker / WebServiceWorkerRequest.h
blobcd2caa70a00f00fb8aad696be9df7149b994b494
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.
5 #ifndef WebServiceWorkerRequest_h
6 #define WebServiceWorkerRequest_h
8 #include "public/platform/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 #include "public/platform/WebURLRequest.h"
15 #if INSIDE_BLINK
16 #include "platform/network/HTTPHeaderMap.h"
17 #include "platform/weborigin/Referrer.h"
18 #include "wtf/Forward.h"
19 #include "wtf/text/StringHash.h"
20 #include <utility>
21 #endif
23 namespace blink {
25 class BlobDataHandle;
26 class WebHTTPHeaderVisitor;
27 class WebServiceWorkerRequestPrivate;
29 // Represents a request for a web resource.
30 class BLINK_PLATFORM_EXPORT WebServiceWorkerRequest {
31 public:
32 ~WebServiceWorkerRequest() { reset(); }
33 WebServiceWorkerRequest();
34 WebServiceWorkerRequest(const WebServiceWorkerRequest& other) { assign(other); }
35 WebServiceWorkerRequest& operator=(const WebServiceWorkerRequest& other)
37 assign(other);
38 return *this;
41 void reset();
42 void assign(const WebServiceWorkerRequest&);
44 void setURL(const WebURL&);
45 WebURL url() const;
47 void setMethod(const WebString&);
48 WebString method() const;
50 void setHeader(const WebString& key, const WebString& value);
52 // If the key already exists, the value is appended to the existing value
53 // with a comma delimiter between them.
54 void appendHeader(const WebString& key, const WebString& value);
56 void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) const;
58 void setBlob(const WebString& uuid, long long size);
60 void setReferrer(const WebString&, WebReferrerPolicy);
61 WebURL referrerUrl() const;
62 WebReferrerPolicy referrerPolicy() const;
64 void setMode(WebURLRequest::FetchRequestMode);
65 WebURLRequest::FetchRequestMode mode() const;
67 void setCredentialsMode(WebURLRequest::FetchCredentialsMode);
68 WebURLRequest::FetchCredentialsMode credentialsMode() const;
70 void setRedirectMode(WebURLRequest::FetchRedirectMode);
71 WebURLRequest::FetchRedirectMode redirectMode() const;
73 void setRequestContext(WebURLRequest::RequestContext);
74 WebURLRequest::RequestContext requestContext() const;
76 void setFrameType(WebURLRequest::FrameType);
77 WebURLRequest::FrameType frameType() const;
79 void setIsReload(bool);
80 bool isReload() const;
82 #if INSIDE_BLINK
83 const HTTPHeaderMap& headers() const;
84 PassRefPtr<BlobDataHandle> blobDataHandle() const;
85 const Referrer& referrer() const;
86 #endif
88 private:
89 WebPrivatePtr<WebServiceWorkerRequestPrivate> m_private;
92 } // namespace blink
94 #endif // WebServiceWorkerRequest_h