Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: public/platform/WebServiceWorkerResponse.h

Issue 287363004: ServiceWorker: support Response.{status,statusText,headers} [blink] (2/3) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/platform/exported/WebServiceWorkerResponse.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "public/platform/WebPrivatePtr.h" 9 #include "public/platform/WebPrivatePtr.h"
9 #include "public/platform/WebString.h" 10 #include "public/platform/WebString.h"
10 #include "public/platform/WebVector.h" 11 #include "public/platform/WebVector.h"
11 12
13 #if INSIDE_BLINK
14 #include "wtf/Forward.h"
15 #include "wtf/HashMap.h"
16 #include "wtf/text/StringHash.h"
17 #endif
18
19 // FIXME: Remove this after chromium code is cleaned up.
20 #define NEW_SERVICE_WORKER_RESPONSE_INTERFACE
21
12 namespace blink { 22 namespace blink {
13 23
24 class WebServiceWorkerResponsePrivate;
25
14 // Represents a response to a fetch operation. ServiceWorker uses this to 26 // Represents a response to a fetch operation. ServiceWorker uses this to
15 // 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
16 // and fetch() API to also use it. 28 // and fetch() API to also use it.
17 class BLINK_PLATFORM_EXPORT WebServiceWorkerResponse { 29 class BLINK_PLATFORM_EXPORT WebServiceWorkerResponse {
18 public: 30 public:
19 void setStatusCode(unsigned short); 31 ~WebServiceWorkerResponse() { reset(); }
20 unsigned short statusCode() const; 32 WebServiceWorkerResponse();
33 WebServiceWorkerResponse& operator=(const WebServiceWorkerResponse& other)
34 {
35 assign(other);
36 return *this;
37 }
38
39 void reset();
40 void assign(const WebServiceWorkerResponse&);
41
42 void setStatus(unsigned short);
43 unsigned short status() const;
21 44
22 void setStatusText(const WebString&); 45 void setStatusText(const WebString&);
23 WebString statusText() const; 46 WebString statusText() const;
24 47
25 void setMethod(const WebString&); 48 void setHeader(const WebString& key, const WebString& value);
26 WebString method() const; 49 WebVector<WebString> getHeaderKeys() const;
50 WebString getHeader(const WebString& key) const;
27 51
28 // FIXME: Eventually this should have additional methods such as for headers and blob. 52 #if INSIDE_BLINK
53 void setHeaders(const HashMap<String, String>&);
54 const HashMap<String, String>& headers() const;
55 #endif
56
57 // FIXME: Eventually this should have additional methods such as for blob.
29 58
30 private: 59 private:
31 unsigned short m_statusCode; 60 WebPrivatePtr<WebServiceWorkerResponsePrivate> m_private;
32 WebString m_statusText;
33 WebString m_method;
34 }; 61 };
35 62
36 } // namespace blink 63 } // namespace blink
37 64
38 #endif // WebServiceWorkerResponse_h 65 #endif // WebServiceWorkerResponse_h
OLDNEW
« no previous file with comments | « Source/platform/exported/WebServiceWorkerResponse.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698