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

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, 7 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
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"
9 #include "public/platform/WebPrivatePtr.h"
8 #include "public/platform/WebPrivatePtr.h" 10 #include "public/platform/WebPrivatePtr.h"
falken 2014/05/24 14:32:36 double include WebPrivatePtr.h
kinuko 2014/05/26 05:45:13 Done.
9 #include "public/platform/WebString.h" 11 #include "public/platform/WebString.h"
10 #include "public/platform/WebVector.h" 12 #include "public/platform/WebVector.h"
11 13
14 #if INSIDE_BLINK
15 #include "wtf/Forward.h"
16 #include "wtf/HashMap.h"
17 #include "wtf/text/StringHash.h"
18 #endif
19
20 // FIXME: Remove this after chromium code is cleaned up.
21 #define NEW_SERVICE_WORKER_RESPONSE_INTERFACE
22
12 namespace blink { 23 namespace blink {
13 24
25 class WebServiceWorkerResponsePrivate;
26
14 // Represents a response to a fetch operation. ServiceWorker uses this to 27 // 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 28 // respond to a FetchEvent dispatched by the browser. The plan is for the Cache
16 // and fetch() API to also use it. 29 // and fetch() API to also use it.
17 class BLINK_PLATFORM_EXPORT WebServiceWorkerResponse { 30 class BLINK_PLATFORM_EXPORT WebServiceWorkerResponse {
18 public: 31 public:
19 void setStatusCode(unsigned short); 32 ~WebServiceWorkerResponse() { reset(); }
20 unsigned short statusCode() const; 33 WebServiceWorkerResponse();
34 WebServiceWorkerResponse& operator=(const WebServiceWorkerResponse& r)
falken 2014/05/24 14:32:36 I think Blink style is to write out full words.. "
kinuko 2014/05/26 05:45:13 Done, but for operator= impl using assign() in pub
35 {
36 assign(r);
37 return *this;
38 }
39
40 void reset();
41 void assign(const WebServiceWorkerResponse&);
42
43 void setStatus(unsigned short);
44 unsigned short status() const;
21 45
22 void setStatusText(const WebString&); 46 void setStatusText(const WebString&);
23 WebString statusText() const; 47 WebString statusText() const;
24 48
25 void setMethod(const WebString&); 49 void setHeader(const WebString& key, const WebString& value);
26 WebString method() const; 50 WebVector<WebString> getHeaderKeys() const;
51 WebString getHeader(const WebString& key) const;
27 52
28 // FIXME: Eventually this should have additional methods such as for headers and blob. 53 #if INSIDE_BLINK
54 BLINK_COMMON_EXPORT void setHeaders(const HashMap<String, String>&);
55 BLINK_COMMON_EXPORT const HashMap<String, String>& headers() const;
56 #endif
57
58 // FIXME: Eventually this should have additional methods such as for blob.
29 59
30 private: 60 private:
31 unsigned short m_statusCode; 61 WebPrivatePtr<WebServiceWorkerResponsePrivate> m_private;
32 WebString m_statusText; 62 // unsigned short m_status;
jsbell 2014/05/23 20:59:49 Delete these?
kinuko 2014/05/26 05:45:13 Done.
33 WebString m_method; 63 // WebString m_statusText;
34 }; 64 };
35 65
36 } // namespace blink 66 } // namespace blink
37 67
38 #endif // WebServiceWorkerResponse_h 68 #endif // WebServiceWorkerResponse_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698