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

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

Issue 1262943002: Move ServiceWorker public headers to public/{web,platform}/modules/serviceworker (1/3) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased 2 Created 5 years, 4 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 #include "public/platform/modules/serviceworker/WebServiceWorkerResponse.h"
6 #define WebServiceWorkerResponse_h
7
8 #include "WebCommon.h"
9 #include "public/platform/WebPrivatePtr.h"
10 #include "public/platform/WebServiceWorkerResponseError.h"
11 #include "public/platform/WebServiceWorkerResponseType.h"
12 #include "public/platform/WebString.h"
13 #include "public/platform/WebURL.h"
14 #include "public/platform/WebVector.h"
15
16 #if INSIDE_BLINK
17 #include "wtf/Forward.h"
18 #include "wtf/HashMap.h"
19 #include "wtf/text/StringHash.h"
20 #endif
21
22 namespace blink {
23
24 class BlobDataHandle;
25 class HTTPHeaderMap;
26 class WebHTTPHeaderVisitor;
27 class WebServiceWorkerResponsePrivate;
28
29 // Represents a response to a fetch operation. ServiceWorker uses this to
30 // respond to a FetchEvent dispatched by the browser. The plan is for the Cache
31 // and fetch() API to also use it.
32 class BLINK_PLATFORM_EXPORT WebServiceWorkerResponse {
33 public:
34 ~WebServiceWorkerResponse() { reset(); }
35 WebServiceWorkerResponse();
36 WebServiceWorkerResponse(const WebServiceWorkerResponse& other) { assign(oth er); }
37 WebServiceWorkerResponse& operator=(const WebServiceWorkerResponse& other)
38 {
39 assign(other);
40 return *this;
41 }
42
43 void reset();
44 void assign(const WebServiceWorkerResponse&);
45
46 void setURL(const WebURL&);
47 WebURL url() const;
48
49 void setStatus(unsigned short);
50 unsigned short status() const;
51
52 void setStatusText(const WebString&);
53 WebString statusText() const;
54
55 void setResponseType(WebServiceWorkerResponseType);
56 WebServiceWorkerResponseType responseType() const;
57
58 void setHeader(const WebString& key, const WebString& value);
59
60 // If the key already exists, appends the value to the same key (comma
61 // delimited) else creates a new entry.
62 void appendHeader(const WebString& key, const WebString& value);
63
64 WebVector<WebString> getHeaderKeys() const;
65 WebString getHeader(const WebString& key) const;
66 void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) const;
67
68 void setBlob(const WebString& uuid, uint64_t size);
69 WebString blobUUID() const;
70 uint64_t blobSize() const;
71
72 void setStreamURL(const WebURL&);
73 WebURL streamURL() const;
74
75 // Provides a more detailed error when status() is zero.
76 void setError(WebServiceWorkerResponseError);
77 WebServiceWorkerResponseError error() const;
78
79 #if INSIDE_BLINK
80 const HTTPHeaderMap& headers() const;
81
82 void setBlobDataHandle(PassRefPtr<BlobDataHandle>);
83 PassRefPtr<BlobDataHandle> blobDataHandle() const;
84 #endif
85
86 private:
87 WebPrivatePtr<WebServiceWorkerResponsePrivate> m_private;
88 };
89
90 } // namespace blink
91
92 #endif // WebServiceWorkerResponse_h
OLDNEW
« no previous file with comments | « public/platform/WebServiceWorkerRequest.h ('k') | public/platform/WebServiceWorkerResponseError.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698