OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions are | |
6 * met: | |
7 * | |
8 * * Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * * Redistributions in binary form must reproduce the above | |
11 * copyright notice, this list of conditions and the following disclaimer | |
12 * in the documentation and/or other materials provided with the | |
13 * distribution. | |
14 * * Neither the name of Google Inc. nor the names of its | |
15 * contributors may be used to endorse or promote products derived from | |
16 * this software without specific prior written permission. | |
17 * | |
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
29 */ | |
30 | |
31 #ifndef SKY_ENGINE_PUBLIC_PLATFORM_WEBURLRESPONSE_H_ | |
32 #define SKY_ENGINE_PUBLIC_PLATFORM_WEBURLRESPONSE_H_ | |
33 | |
34 #include "sky/engine/public/platform/WebCommon.h" | |
35 #include "sky/engine/public/platform/WebPrivateOwnPtr.h" | |
36 | |
37 namespace blink { | |
38 | |
39 class ResourceResponse; | |
40 class WebCString; | |
41 class WebHTTPHeaderVisitor; | |
42 class WebHTTPLoadInfo; | |
43 class WebString; | |
44 class WebURL; | |
45 class WebURLLoadTiming; | |
46 class WebURLResponsePrivate; | |
47 | |
48 class WebURLResponse { | |
49 public: | |
50 enum HTTPVersion { Unknown, HTTP_0_9, HTTP_1_0, HTTP_1_1 }; | |
51 | |
52 class ExtraData { | |
53 public: | |
54 virtual ~ExtraData() { } | |
55 }; | |
56 | |
57 ~WebURLResponse() { reset(); } | |
58 | |
59 WebURLResponse() : m_private(0) { } | |
60 WebURLResponse(const WebURLResponse& r) : m_private(0) { assign(r); } | |
61 WebURLResponse& operator=(const WebURLResponse& r) | |
62 { | |
63 assign(r); | |
64 return *this; | |
65 } | |
66 | |
67 explicit WebURLResponse(const WebURL& url) : m_private(0) | |
68 { | |
69 initialize(); | |
70 setURL(url); | |
71 } | |
72 | |
73 BLINK_PLATFORM_EXPORT void initialize(); | |
74 BLINK_PLATFORM_EXPORT void reset(); | |
75 BLINK_PLATFORM_EXPORT void assign(const WebURLResponse&); | |
76 | |
77 BLINK_PLATFORM_EXPORT bool isNull() const; | |
78 | |
79 BLINK_PLATFORM_EXPORT WebURL url() const; | |
80 BLINK_PLATFORM_EXPORT void setURL(const WebURL&); | |
81 | |
82 BLINK_PLATFORM_EXPORT unsigned connectionID() const; | |
83 BLINK_PLATFORM_EXPORT void setConnectionID(unsigned); | |
84 | |
85 BLINK_PLATFORM_EXPORT bool connectionReused() const; | |
86 BLINK_PLATFORM_EXPORT void setConnectionReused(bool); | |
87 | |
88 BLINK_PLATFORM_EXPORT WebURLLoadTiming loadTiming(); | |
89 BLINK_PLATFORM_EXPORT void setLoadTiming(const WebURLLoadTiming&); | |
90 | |
91 BLINK_PLATFORM_EXPORT WebHTTPLoadInfo httpLoadInfo(); | |
92 BLINK_PLATFORM_EXPORT void setHTTPLoadInfo(const WebHTTPLoadInfo&); | |
93 | |
94 BLINK_PLATFORM_EXPORT double responseTime() const; | |
95 BLINK_PLATFORM_EXPORT void setResponseTime(double); | |
96 | |
97 BLINK_PLATFORM_EXPORT WebString mimeType() const; | |
98 BLINK_PLATFORM_EXPORT void setMIMEType(const WebString&); | |
99 | |
100 BLINK_PLATFORM_EXPORT long long expectedContentLength() const; | |
101 BLINK_PLATFORM_EXPORT void setExpectedContentLength(long long); | |
102 | |
103 BLINK_PLATFORM_EXPORT WebString textEncodingName() const; | |
104 BLINK_PLATFORM_EXPORT void setTextEncodingName(const WebString&); | |
105 | |
106 BLINK_PLATFORM_EXPORT WebString suggestedFileName() const; | |
107 BLINK_PLATFORM_EXPORT void setSuggestedFileName(const WebString&); | |
108 | |
109 BLINK_PLATFORM_EXPORT HTTPVersion httpVersion() const; | |
110 BLINK_PLATFORM_EXPORT void setHTTPVersion(HTTPVersion); | |
111 | |
112 BLINK_PLATFORM_EXPORT int httpStatusCode() const; | |
113 BLINK_PLATFORM_EXPORT void setHTTPStatusCode(int); | |
114 | |
115 BLINK_PLATFORM_EXPORT WebString httpStatusText() const; | |
116 BLINK_PLATFORM_EXPORT void setHTTPStatusText(const WebString&); | |
117 | |
118 BLINK_PLATFORM_EXPORT WebString httpHeaderField(const WebString& name) const
; | |
119 BLINK_PLATFORM_EXPORT void setHTTPHeaderField(const WebString& name, const W
ebString& value); | |
120 BLINK_PLATFORM_EXPORT void addHTTPHeaderField(const WebString& name, const W
ebString& value); | |
121 BLINK_PLATFORM_EXPORT void clearHTTPHeaderField(const WebString& name); | |
122 BLINK_PLATFORM_EXPORT void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) cons
t; | |
123 | |
124 BLINK_PLATFORM_EXPORT double lastModifiedDate() const; | |
125 BLINK_PLATFORM_EXPORT void setLastModifiedDate(double); | |
126 | |
127 // A consumer controlled value intended to be used to record opaque | |
128 // security info related to this request. | |
129 BLINK_PLATFORM_EXPORT WebCString securityInfo() const; | |
130 BLINK_PLATFORM_EXPORT void setSecurityInfo(const WebCString&); | |
131 | |
132 #if INSIDE_BLINK | |
133 BLINK_PLATFORM_EXPORT ResourceResponse& toMutableResourceResponse(); | |
134 BLINK_PLATFORM_EXPORT const ResourceResponse& toResourceResponse() const; | |
135 #endif | |
136 | |
137 // Flag whether this request was served from the disk cache entry. | |
138 BLINK_PLATFORM_EXPORT bool wasCached() const; | |
139 BLINK_PLATFORM_EXPORT void setWasCached(bool); | |
140 | |
141 // Flag whether this request was loaded via the SPDY protocol or not. | |
142 // SPDY is an experimental web protocol, see http://dev.chromium.org/spdy | |
143 BLINK_PLATFORM_EXPORT bool wasFetchedViaSPDY() const; | |
144 BLINK_PLATFORM_EXPORT void setWasFetchedViaSPDY(bool); | |
145 | |
146 // Flag whether this request was loaded after the TLS/Next-Protocol-Negotiat
ion was used. | |
147 // This is related to SPDY. | |
148 BLINK_PLATFORM_EXPORT bool wasNpnNegotiated() const; | |
149 BLINK_PLATFORM_EXPORT void setWasNpnNegotiated(bool); | |
150 | |
151 // Flag whether this request was made when "Alternate-Protocol: xxx" | |
152 // is present in server's response. | |
153 BLINK_PLATFORM_EXPORT bool wasAlternateProtocolAvailable() const; | |
154 BLINK_PLATFORM_EXPORT void setWasAlternateProtocolAvailable(bool); | |
155 | |
156 // Flag whether this request was loaded via an explicit proxy (HTTP, SOCKS,
etc). | |
157 BLINK_PLATFORM_EXPORT bool wasFetchedViaProxy() const; | |
158 BLINK_PLATFORM_EXPORT void setWasFetchedViaProxy(bool); | |
159 | |
160 // Flag whether this request was loaded via a ServiceWorker. | |
161 BLINK_PLATFORM_EXPORT bool wasFetchedViaServiceWorker() const; | |
162 BLINK_PLATFORM_EXPORT void setWasFetchedViaServiceWorker(bool); | |
163 | |
164 // Flag whether this request is part of a multipart response. | |
165 BLINK_PLATFORM_EXPORT bool isMultipartPayload() const; | |
166 BLINK_PLATFORM_EXPORT void setIsMultipartPayload(bool); | |
167 | |
168 // This indicates the location of a downloaded response if the | |
169 // WebURLRequest had the downloadToFile flag set to true. This file path | |
170 // remains valid for the lifetime of the WebURLLoader used to create it. | |
171 BLINK_PLATFORM_EXPORT WebString downloadFilePath() const; | |
172 BLINK_PLATFORM_EXPORT void setDownloadFilePath(const WebString&); | |
173 | |
174 // Remote IP address of the socket which fetched this resource. | |
175 BLINK_PLATFORM_EXPORT WebString remoteIPAddress() const; | |
176 BLINK_PLATFORM_EXPORT void setRemoteIPAddress(const WebString&); | |
177 | |
178 // Remote port number of the socket which fetched this resource. | |
179 BLINK_PLATFORM_EXPORT unsigned short remotePort() const; | |
180 BLINK_PLATFORM_EXPORT void setRemotePort(unsigned short); | |
181 | |
182 // Extra data associated with the underlying resource response. Resource | |
183 // responses can be copied. If non-null, each copy of a resource response | |
184 // holds a pointer to the extra data, and the extra data pointer will be | |
185 // deleted when the last resource response is destroyed. Setting the extra | |
186 // data pointer will cause the underlying resource response to be | |
187 // dissociated from any existing non-null extra data pointer. | |
188 BLINK_PLATFORM_EXPORT ExtraData* extraData() const; | |
189 BLINK_PLATFORM_EXPORT void setExtraData(ExtraData*); | |
190 | |
191 protected: | |
192 BLINK_PLATFORM_EXPORT void assign(WebURLResponsePrivate*); | |
193 | |
194 private: | |
195 WebURLResponsePrivate* m_private; | |
196 }; | |
197 | |
198 } // namespace blink | |
199 | |
200 #endif // SKY_ENGINE_PUBLIC_PLATFORM_WEBURLRESPONSE_H_ | |
OLD | NEW |