Chromium Code Reviews| 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/WebVector.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 class BLINK_PLATFORM_EXPORT WebServiceWorkerRequest { |
|
falken
2014/05/30 02:31:20
maybe include a lightweight comment for this class
horo
2014/05/30 04:04:04
Done.
| |
| 27 // respond to a FetchEvent dispatched by the browser. The plan is for the Cache | |
| 28 // and fetch() API to also use it. | |
| 29 class BLINK_PLATFORM_EXPORT WebServiceWorkerResponse { | |
| 30 public: | 24 public: |
| 31 ~WebServiceWorkerResponse() { reset(); } | 25 ~WebServiceWorkerRequest() { reset(); } |
| 32 WebServiceWorkerResponse(); | 26 WebServiceWorkerRequest(); |
| 33 WebServiceWorkerResponse& operator=(const WebServiceWorkerResponse& other) | 27 WebServiceWorkerRequest& operator=(const WebServiceWorkerRequest& other) |
| 34 { | 28 { |
| 35 assign(other); | 29 assign(other); |
| 36 return *this; | 30 return *this; |
| 37 } | 31 } |
| 38 | 32 |
| 39 void reset(); | 33 void reset(); |
| 40 void assign(const WebServiceWorkerResponse&); | 34 void assign(const WebServiceWorkerRequest&); |
| 41 | 35 |
| 42 void setStatus(unsigned short); | 36 void setURL(const WebString&); |
| 43 unsigned short status() const; | 37 WebString url() const; |
| 44 | 38 |
| 45 void setStatusText(const WebString&); | 39 void setMethod(const WebString&); |
| 46 WebString statusText() const; | 40 WebString method() const; |
| 41 | |
| 42 void setOrigin(const WebString&); | |
| 43 WebString origin() 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 |