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