OLD | NEW |
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 WebServiceWorkerRequest_h | 5 #ifndef WebServiceWorkerRequest_h |
6 #define WebServiceWorkerRequest_h | 6 #define WebServiceWorkerRequest_h |
7 | 7 |
8 #include "WebCommon.h" | 8 #include "WebCommon.h" |
9 #include "public/platform/WebPrivatePtr.h" | 9 #include "public/platform/WebPrivatePtr.h" |
10 #include "public/platform/WebReferrerPolicy.h" | 10 #include "public/platform/WebReferrerPolicy.h" |
11 #include "public/platform/WebString.h" | 11 #include "public/platform/WebString.h" |
12 #include "public/platform/WebURL.h" | 12 #include "public/platform/WebURL.h" |
13 | 13 |
14 #if INSIDE_BLINK | 14 #if INSIDE_BLINK |
15 #include "platform/network/HTTPHeaderMap.h" | 15 #include "platform/network/HTTPHeaderMap.h" |
16 #include "platform/weborigin/Referrer.h" | 16 #include "platform/weborigin/Referrer.h" |
17 #include "wtf/Forward.h" | 17 #include "wtf/Forward.h" |
18 #include "wtf/text/StringHash.h" | 18 #include "wtf/text/StringHash.h" |
19 #include <utility> | 19 #include <utility> |
20 #endif | 20 #endif |
21 | 21 |
22 namespace blink { | 22 namespace blink { |
23 | 23 |
| 24 class WebHTTPHeaderVisitor; |
24 class WebServiceWorkerRequestPrivate; | 25 class WebServiceWorkerRequestPrivate; |
25 | 26 |
26 // Represents a request of a fetch operation. FetchEvent dispatched by the | 27 // Represents a request of a fetch operation. FetchEvent dispatched by the |
27 // browser contains this. The plan is for the Cache and fetch() API to also use | 28 // browser contains this. The plan is for the Cache and fetch() API to also use |
28 // it. | 29 // it. |
29 class BLINK_PLATFORM_EXPORT WebServiceWorkerRequest { | 30 class BLINK_PLATFORM_EXPORT WebServiceWorkerRequest { |
30 public: | 31 public: |
31 ~WebServiceWorkerRequest() { reset(); } | 32 ~WebServiceWorkerRequest() { reset(); } |
32 WebServiceWorkerRequest(); | 33 WebServiceWorkerRequest(); |
| 34 WebServiceWorkerRequest(const WebServiceWorkerRequest& other) { assign(other
); } |
33 WebServiceWorkerRequest& operator=(const WebServiceWorkerRequest& other) | 35 WebServiceWorkerRequest& operator=(const WebServiceWorkerRequest& other) |
34 { | 36 { |
35 assign(other); | 37 assign(other); |
36 return *this; | 38 return *this; |
37 } | 39 } |
38 | 40 |
39 void reset(); | 41 void reset(); |
40 void assign(const WebServiceWorkerRequest&); | 42 void assign(const WebServiceWorkerRequest&); |
41 | 43 |
42 void setURL(const WebURL&); | 44 void setURL(const WebURL&); |
43 WebURL url() const; | 45 WebURL url() const; |
44 | 46 |
45 void setMethod(const WebString&); | 47 void setMethod(const WebString&); |
46 WebString method() const; | 48 WebString method() const; |
47 | 49 |
48 void setHeader(const WebString& key, const WebString& value); | 50 void setHeader(const WebString& key, const WebString& value); |
| 51 void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) const; |
49 | 52 |
50 void setReferrer(const WebString&, WebReferrerPolicy); | 53 void setReferrer(const WebString&, WebReferrerPolicy); |
| 54 WebURL referrerUrl() const; |
51 | 55 |
52 void setIsReload(bool); | 56 void setIsReload(bool); |
53 bool isReload() const; | 57 bool isReload() const; |
54 | 58 |
55 #if INSIDE_BLINK | 59 #if INSIDE_BLINK |
56 const blink::HTTPHeaderMap& headers() const; | 60 const blink::HTTPHeaderMap& headers() const; |
57 const blink::Referrer& referrer() const; | 61 const blink::Referrer& referrer() const; |
58 #endif | 62 #endif |
59 | 63 |
60 private: | 64 private: |
61 WebPrivatePtr<WebServiceWorkerRequestPrivate> m_private; | 65 WebPrivatePtr<WebServiceWorkerRequestPrivate> m_private; |
62 }; | 66 }; |
63 | 67 |
64 } // namespace blink | 68 } // namespace blink |
65 | 69 |
66 #endif // WebServiceWorkerRequest_h | 70 #endif // WebServiceWorkerRequest_h |
OLD | NEW |