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 WebServiceWorkerResponse_h | 5 #ifndef WebServiceWorkerResponse_h |
6 #define WebServiceWorkerResponse_h | 6 #define WebServiceWorkerResponse_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/WebString.h" | 10 #include "public/platform/WebString.h" |
11 #include "public/platform/WebURL.h" | 11 #include "public/platform/WebURL.h" |
12 #include "public/platform/WebVector.h" | 12 #include "public/platform/WebVector.h" |
13 | 13 |
14 #if INSIDE_BLINK | 14 #if INSIDE_BLINK |
15 #include "wtf/Forward.h" | 15 #include "wtf/Forward.h" |
16 #include "wtf/HashMap.h" | 16 #include "wtf/HashMap.h" |
17 #include "wtf/text/StringHash.h" | 17 #include "wtf/text/StringHash.h" |
18 | 18 |
19 namespace blink { | 19 namespace blink { |
20 class BlobDataHandle; | 20 class BlobDataHandle; |
21 } | 21 } |
22 #endif | 22 #endif |
23 | 23 |
24 namespace blink { | 24 namespace blink { |
25 | 25 |
| 26 class WebHTTPHeaderVisitor; |
26 class WebServiceWorkerResponsePrivate; | 27 class WebServiceWorkerResponsePrivate; |
27 | 28 |
28 // Represents a response to a fetch operation. ServiceWorker uses this to | 29 // Represents a response to a fetch operation. ServiceWorker uses this to |
29 // respond to a FetchEvent dispatched by the browser. The plan is for the Cache | 30 // respond to a FetchEvent dispatched by the browser. The plan is for the Cache |
30 // and fetch() API to also use it. | 31 // and fetch() API to also use it. |
31 class BLINK_PLATFORM_EXPORT WebServiceWorkerResponse { | 32 class BLINK_PLATFORM_EXPORT WebServiceWorkerResponse { |
32 public: | 33 public: |
33 ~WebServiceWorkerResponse() { reset(); } | 34 ~WebServiceWorkerResponse() { reset(); } |
34 WebServiceWorkerResponse(); | 35 WebServiceWorkerResponse(); |
| 36 WebServiceWorkerResponse(const WebServiceWorkerResponse& other) { assign(oth
er); } |
35 WebServiceWorkerResponse& operator=(const WebServiceWorkerResponse& other) | 37 WebServiceWorkerResponse& operator=(const WebServiceWorkerResponse& other) |
36 { | 38 { |
37 assign(other); | 39 assign(other); |
38 return *this; | 40 return *this; |
39 } | 41 } |
40 | 42 |
41 void reset(); | 43 void reset(); |
42 void assign(const WebServiceWorkerResponse&); | 44 void assign(const WebServiceWorkerResponse&); |
43 | 45 |
44 void setURL(const WebURL&); | 46 void setURL(const WebURL&); |
45 WebURL url() const; | 47 WebURL url() const; |
46 | 48 |
47 void setStatus(unsigned short); | 49 void setStatus(unsigned short); |
48 unsigned short status() const; | 50 unsigned short status() const; |
49 | 51 |
50 void setStatusText(const WebString&); | 52 void setStatusText(const WebString&); |
51 WebString statusText() const; | 53 WebString statusText() const; |
52 | 54 |
53 void setHeader(const WebString& key, const WebString& value); | 55 void setHeader(const WebString& key, const WebString& value); |
54 WebVector<WebString> getHeaderKeys() const; | 56 WebVector<WebString> getHeaderKeys() const; |
55 WebString getHeader(const WebString& key) const; | 57 WebString getHeader(const WebString& key) const; |
| 58 void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) const; |
56 | 59 |
57 WebString blobUUID() const; | 60 WebString blobUUID() const; |
58 | 61 |
59 #if INSIDE_BLINK | 62 #if INSIDE_BLINK |
60 void setHeaders(const HashMap<String, String>&); | 63 void setHeaders(const HashMap<String, String>&); |
61 const HashMap<String, String>& headers() const; | 64 const HashMap<String, String>& headers() const; |
62 | 65 |
63 void setBlobDataHandle(PassRefPtr<blink::BlobDataHandle>); | 66 void setBlobDataHandle(PassRefPtr<blink::BlobDataHandle>); |
64 PassRefPtr<blink::BlobDataHandle> blobDataHandle() const; | 67 PassRefPtr<blink::BlobDataHandle> blobDataHandle() const; |
65 #endif | 68 #endif |
66 | 69 |
67 private: | 70 private: |
68 WebPrivatePtr<WebServiceWorkerResponsePrivate> m_private; | 71 WebPrivatePtr<WebServiceWorkerResponsePrivate> m_private; |
69 }; | 72 }; |
70 | 73 |
71 } // namespace blink | 74 } // namespace blink |
72 | 75 |
73 #endif // WebServiceWorkerResponse_h | 76 #endif // WebServiceWorkerResponse_h |
OLD | NEW |