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

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

Issue 617003003: Make WebServiceWorkerResponse support ResponseType (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addresses comments from PS4 and fixes some cache tests Created 6 years, 2 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
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 "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"
(...skipping 11 matching lines...) Expand all
22 class BlobDataHandle; 22 class BlobDataHandle;
23 class HTTPHeaderMap; 23 class HTTPHeaderMap;
24 class WebHTTPHeaderVisitor; 24 class WebHTTPHeaderVisitor;
25 class WebServiceWorkerResponsePrivate; 25 class WebServiceWorkerResponsePrivate;
26 26
27 // Represents a response to a fetch operation. ServiceWorker uses this to 27 // Represents a response to a fetch operation. ServiceWorker uses this to
28 // 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
29 // and fetch() API to also use it. 29 // and fetch() API to also use it.
30 class BLINK_PLATFORM_EXPORT WebServiceWorkerResponse { 30 class BLINK_PLATFORM_EXPORT WebServiceWorkerResponse {
31 public: 31 public:
32 enum ResponseType {
33 BasicType,
jochen (gone - plz use gerrit) 2014/10/01 07:46:34 should be ResponseTypeBasic, etc..
jkarlin 2014/10/01 11:26:57 Done.
34 CORSType,
35 DefaultType,
36 ErrorType,
37 OpaqueType,
38 ResponseTypeLast = OpaqueType
39 };
40
32 ~WebServiceWorkerResponse() { reset(); } 41 ~WebServiceWorkerResponse() { reset(); }
33 WebServiceWorkerResponse(); 42 WebServiceWorkerResponse();
34 WebServiceWorkerResponse(const WebServiceWorkerResponse& other) { assign(oth er); } 43 WebServiceWorkerResponse(const WebServiceWorkerResponse& other) { assign(oth er); }
35 WebServiceWorkerResponse& operator=(const WebServiceWorkerResponse& other) 44 WebServiceWorkerResponse& operator=(const WebServiceWorkerResponse& other)
36 { 45 {
37 assign(other); 46 assign(other);
38 return *this; 47 return *this;
39 } 48 }
40 49
41 void reset(); 50 void reset();
42 void assign(const WebServiceWorkerResponse&); 51 void assign(const WebServiceWorkerResponse&);
43 52
44 void setURL(const WebURL&); 53 void setURL(const WebURL&);
45 WebURL url() const; 54 WebURL url() const;
46 55
47 void setStatus(unsigned short); 56 void setStatus(unsigned short);
48 unsigned short status() const; 57 unsigned short status() const;
49 58
50 void setStatusText(const WebString&); 59 void setStatusText(const WebString&);
51 WebString statusText() const; 60 WebString statusText() const;
52 61
62 void setResponseType(ResponseType);
63 ResponseType responseType() const;
64
53 void setHeader(const WebString& key, const WebString& value); 65 void setHeader(const WebString& key, const WebString& value);
54 66
55 // If the key already exists, appends the value to the same key (comma 67 // If the key already exists, appends the value to the same key (comma
56 // delimited) else creates a new entry. 68 // delimited) else creates a new entry.
57 void appendHeader(const WebString& key, const WebString& value); 69 void appendHeader(const WebString& key, const WebString& value);
58 70
59 WebVector<WebString> getHeaderKeys() const; 71 WebVector<WebString> getHeaderKeys() const;
60 WebString getHeader(const WebString& key) const; 72 WebString getHeader(const WebString& key) const;
61 void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) const; 73 void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) const;
62 74
63 WebString blobUUID() const; 75 WebString blobUUID() const;
64 76
65 #if INSIDE_BLINK 77 #if INSIDE_BLINK
66 const HTTPHeaderMap& headers() const; 78 const HTTPHeaderMap& headers() const;
67 79
68 void setBlobDataHandle(PassRefPtr<BlobDataHandle>); 80 void setBlobDataHandle(PassRefPtr<BlobDataHandle>);
69 PassRefPtr<BlobDataHandle> blobDataHandle() const; 81 PassRefPtr<BlobDataHandle> blobDataHandle() const;
70 #endif 82 #endif
71 83
72 private: 84 private:
73 WebPrivatePtr<WebServiceWorkerResponsePrivate> m_private; 85 WebPrivatePtr<WebServiceWorkerResponsePrivate> m_private;
74 }; 86 };
75 87
76 } // namespace blink 88 } // namespace blink
77 89
78 #endif // WebServiceWorkerResponse_h 90 #endif // WebServiceWorkerResponse_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698