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 WebServiceWorkerRequest_h |
6 #define WebServiceWorkerResponse_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/WebString.h" | 10 #include "public/platform/WebString.h" |
11 #include "public/platform/WebVector.h" | 11 #include "public/platform/WebURL.h" |
12 | 12 |
13 #if INSIDE_BLINK | 13 #if INSIDE_BLINK |
14 #include "wtf/Forward.h" | 14 #include "wtf/Forward.h" |
15 #include "wtf/HashMap.h" | 15 #include "wtf/HashMap.h" |
16 #include "wtf/text/StringHash.h" | 16 #include "wtf/text/StringHash.h" |
17 #endif | 17 #endif |
18 | 18 |
19 // FIXME: Remove this after chromium code is cleaned up. | |
20 #define NEW_SERVICE_WORKER_RESPONSE_INTERFACE | |
21 | |
22 namespace blink { | 19 namespace blink { |
23 | 20 |
24 class WebServiceWorkerResponsePrivate; | 21 class WebServiceWorkerRequestPrivate; |
25 | 22 |
26 // Represents a response to a fetch operation. ServiceWorker uses this to | 23 // Represents a request of a fetch operation. FetchEvent dispatched by the |
27 // respond to a FetchEvent dispatched by the browser. The plan is for the Cache | 24 // browser contains this. The plan is for the Cache and fetch() API to also use |
28 // and fetch() API to also use it. | 25 // it. |
29 class BLINK_PLATFORM_EXPORT WebServiceWorkerResponse { | 26 class BLINK_PLATFORM_EXPORT WebServiceWorkerRequest { |
30 public: | 27 public: |
31 ~WebServiceWorkerResponse() { reset(); } | 28 ~WebServiceWorkerRequest() { reset(); } |
32 WebServiceWorkerResponse(); | 29 WebServiceWorkerRequest(); |
33 WebServiceWorkerResponse& operator=(const WebServiceWorkerResponse& other) | 30 WebServiceWorkerRequest& operator=(const WebServiceWorkerRequest& other) |
34 { | 31 { |
35 assign(other); | 32 assign(other); |
36 return *this; | 33 return *this; |
37 } | 34 } |
38 | 35 |
39 void reset(); | 36 void reset(); |
40 void assign(const WebServiceWorkerResponse&); | 37 void assign(const WebServiceWorkerRequest&); |
41 | 38 |
42 void setStatus(unsigned short); | 39 void setURL(const WebURL&); |
43 unsigned short status() const; | 40 WebURL url() const; |
44 | 41 |
45 void setStatusText(const WebString&); | 42 void setMethod(const WebString&); |
46 WebString statusText() const; | 43 WebString method() const; |
47 | 44 |
48 void setHeader(const WebString& key, const WebString& value); | 45 void setHeader(const WebString& key, const WebString& value); |
49 WebVector<WebString> getHeaderKeys() const; | |
50 WebString getHeader(const WebString& key) const; | |
51 | 46 |
52 #if INSIDE_BLINK | 47 #if INSIDE_BLINK |
53 void setHeaders(const HashMap<String, String>&); | |
54 const HashMap<String, String>& headers() const; | 48 const HashMap<String, String>& headers() const; |
55 #endif | 49 #endif |
56 | 50 |
57 // FIXME: Eventually this should have additional methods such as for blob. | |
58 | |
59 private: | 51 private: |
60 WebPrivatePtr<WebServiceWorkerResponsePrivate> m_private; | 52 WebPrivatePtr<WebServiceWorkerRequestPrivate> m_private; |
61 }; | 53 }; |
62 | 54 |
63 } // namespace blink | 55 } // namespace blink |
64 | 56 |
65 #endif // WebServiceWorkerResponse_h | 57 #endif // WebServiceWorkerRequest_h |
OLD | NEW |