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 #endif | 18 #endif |
19 | 19 |
20 namespace blink { | 20 namespace blink { |
21 | 21 |
22 class BlobDataHandle; | 22 class BlobDataHandle; |
| 23 class HTTPHeaderMap; |
23 class WebHTTPHeaderVisitor; | 24 class WebHTTPHeaderVisitor; |
24 class WebServiceWorkerResponsePrivate; | 25 class WebServiceWorkerResponsePrivate; |
25 | 26 |
26 // Represents a response to a fetch operation. ServiceWorker uses this to | 27 // Represents a response to a fetch operation. ServiceWorker uses this to |
27 // respond to a FetchEvent dispatched by the browser. The plan is for the Cache | 28 // respond to a FetchEvent dispatched by the browser. The plan is for the Cache |
28 // and fetch() API to also use it. | 29 // and fetch() API to also use it. |
29 class BLINK_PLATFORM_EXPORT WebServiceWorkerResponse { | 30 class BLINK_PLATFORM_EXPORT WebServiceWorkerResponse { |
30 public: | 31 public: |
31 ~WebServiceWorkerResponse() { reset(); } | 32 ~WebServiceWorkerResponse() { reset(); } |
32 WebServiceWorkerResponse(); | 33 WebServiceWorkerResponse(); |
(...skipping 10 matching lines...) Expand all Loading... |
43 void setURL(const WebURL&); | 44 void setURL(const WebURL&); |
44 WebURL url() const; | 45 WebURL url() const; |
45 | 46 |
46 void setStatus(unsigned short); | 47 void setStatus(unsigned short); |
47 unsigned short status() const; | 48 unsigned short status() const; |
48 | 49 |
49 void setStatusText(const WebString&); | 50 void setStatusText(const WebString&); |
50 WebString statusText() const; | 51 WebString statusText() const; |
51 | 52 |
52 void setHeader(const WebString& key, const WebString& value); | 53 void setHeader(const WebString& key, const WebString& value); |
| 54 |
| 55 // If the key already exists, appends the value to the same key (comma |
| 56 // delimited) else creates a new entry. |
| 57 void appendHeader(const WebString& key, const WebString& value); |
| 58 |
53 WebVector<WebString> getHeaderKeys() const; | 59 WebVector<WebString> getHeaderKeys() const; |
54 WebString getHeader(const WebString& key) const; | 60 WebString getHeader(const WebString& key) const; |
55 void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) const; | 61 void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) const; |
56 | 62 |
57 WebString blobUUID() const; | 63 WebString blobUUID() const; |
58 | 64 |
59 #if INSIDE_BLINK | 65 #if INSIDE_BLINK |
60 void setHeaders(const HashMap<String, String>&); | 66 const HTTPHeaderMap& headers() const; |
61 const HashMap<String, String>& headers() const; | |
62 | 67 |
63 void setBlobDataHandle(PassRefPtr<BlobDataHandle>); | 68 void setBlobDataHandle(PassRefPtr<BlobDataHandle>); |
64 PassRefPtr<BlobDataHandle> blobDataHandle() const; | 69 PassRefPtr<BlobDataHandle> blobDataHandle() const; |
65 #endif | 70 #endif |
66 | 71 |
67 private: | 72 private: |
68 WebPrivatePtr<WebServiceWorkerResponsePrivate> m_private; | 73 WebPrivatePtr<WebServiceWorkerResponsePrivate> m_private; |
69 }; | 74 }; |
70 | 75 |
71 } // namespace blink | 76 } // namespace blink |
72 | 77 |
73 #endif // WebServiceWorkerResponse_h | 78 #endif // WebServiceWorkerResponse_h |
OLD | NEW |