#ifndef WebURLResponse_h
#define WebURLResponse_h
#include "WebCommon.h"
#include "WebPrivateOwnPtr.h"
#if INSIDE_BLINK
namespace WebCore { class ResourceResponse; }
#endif
namespace blink {
class WebCString;
class WebHTTPHeaderVisitor;
class WebHTTPLoadInfo;
class WebString;
class WebURL;
class WebURLLoadTiming;
class WebURLResponsePrivate;
class WebURLResponse {
public:
enum HTTPVersion { Unknown, HTTP_0_9, HTTP_1_0, HTTP_1_1 };
class ExtraData {
public:
virtual ~ExtraData() { }
};
~WebURLResponse() { reset(); }
WebURLResponse() : m_private(0) { }
WebURLResponse(const WebURLResponse& r) : m_private(0) { assign(r); }
WebURLResponse& operator=(const WebURLResponse& r)
{
assign(r);
return *this;
}
explicit WebURLResponse(const WebURL& url) : m_private(0)
{
initialize();
setURL(url);
}
BLINK_PLATFORM_EXPORT void initialize();
BLINK_PLATFORM_EXPORT void reset();
BLINK_PLATFORM_EXPORT void assign(const WebURLResponse&);
BLINK_PLATFORM_EXPORT bool isNull() const;
BLINK_PLATFORM_EXPORT WebURL url() const;
BLINK_PLATFORM_EXPORT void setURL(const WebURL&);
BLINK_PLATFORM_EXPORT unsigned connectionID() const;
BLINK_PLATFORM_EXPORT void setConnectionID(unsigned);
BLINK_PLATFORM_EXPORT bool connectionReused() const;
BLINK_PLATFORM_EXPORT void setConnectionReused(bool);
BLINK_PLATFORM_EXPORT WebURLLoadTiming loadTiming();
BLINK_PLATFORM_EXPORT void setLoadTiming(const WebURLLoadTiming&);
BLINK_PLATFORM_EXPORT WebHTTPLoadInfo httpLoadInfo();
BLINK_PLATFORM_EXPORT void setHTTPLoadInfo(const WebHTTPLoadInfo&);
BLINK_PLATFORM_EXPORT double responseTime() const;
BLINK_PLATFORM_EXPORT void setResponseTime(double);
BLINK_PLATFORM_EXPORT WebString mimeType() const;
BLINK_PLATFORM_EXPORT void setMIMEType(const WebString&);
BLINK_PLATFORM_EXPORT long long expectedContentLength() const;
BLINK_PLATFORM_EXPORT void setExpectedContentLength(long long);
BLINK_PLATFORM_EXPORT WebString textEncodingName() const;
BLINK_PLATFORM_EXPORT void setTextEncodingName(const WebString&);
BLINK_PLATFORM_EXPORT WebString suggestedFileName() const;
BLINK_PLATFORM_EXPORT void setSuggestedFileName(const WebString&);
BLINK_PLATFORM_EXPORT HTTPVersion httpVersion() const;
BLINK_PLATFORM_EXPORT void setHTTPVersion(HTTPVersion);
BLINK_PLATFORM_EXPORT int httpStatusCode() const;
BLINK_PLATFORM_EXPORT void setHTTPStatusCode(int);
BLINK_PLATFORM_EXPORT WebString httpStatusText() const;
BLINK_PLATFORM_EXPORT void setHTTPStatusText(const WebString&);
BLINK_PLATFORM_EXPORT WebString httpHeaderField(const WebString& name) const;
BLINK_PLATFORM_EXPORT void setHTTPHeaderField(const WebString& name, const WebString& value);
BLINK_PLATFORM_EXPORT void addHTTPHeaderField(const WebString& name, const WebString& value);
BLINK_PLATFORM_EXPORT void clearHTTPHeaderField(const WebString& name);
BLINK_PLATFORM_EXPORT void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) const;
BLINK_PLATFORM_EXPORT double lastModifiedDate() const;
BLINK_PLATFORM_EXPORT void setLastModifiedDate(double);
BLINK_PLATFORM_EXPORT long long appCacheID() const;
BLINK_PLATFORM_EXPORT void setAppCacheID(long long);
BLINK_PLATFORM_EXPORT WebURL appCacheManifestURL() const;
BLINK_PLATFORM_EXPORT void setAppCacheManifestURL(const WebURL&);
BLINK_PLATFORM_EXPORT WebCString securityInfo() const;
BLINK_PLATFORM_EXPORT void setSecurityInfo(const WebCString&);
#if INSIDE_BLINK
BLINK_PLATFORM_EXPORT WebCore::ResourceResponse& toMutableResourceResponse();
BLINK_PLATFORM_EXPORT const WebCore::ResourceResponse& toResourceResponse() const;
#endif
BLINK_PLATFORM_EXPORT bool wasCached() const;
BLINK_PLATFORM_EXPORT void setWasCached(bool);
BLINK_PLATFORM_EXPORT bool wasFetchedViaSPDY() const;
BLINK_PLATFORM_EXPORT void setWasFetchedViaSPDY(bool);
BLINK_PLATFORM_EXPORT bool wasNpnNegotiated() const;
BLINK_PLATFORM_EXPORT void setWasNpnNegotiated(bool);
BLINK_PLATFORM_EXPORT bool wasAlternateProtocolAvailable() const;
BLINK_PLATFORM_EXPORT void setWasAlternateProtocolAvailable(bool);
BLINK_PLATFORM_EXPORT bool wasFetchedViaProxy() const;
BLINK_PLATFORM_EXPORT void setWasFetchedViaProxy(bool);
BLINK_PLATFORM_EXPORT bool isMultipartPayload() const;
BLINK_PLATFORM_EXPORT void setIsMultipartPayload(bool);
BLINK_PLATFORM_EXPORT WebString downloadFilePath() const;
BLINK_PLATFORM_EXPORT void setDownloadFilePath(const WebString&);
BLINK_PLATFORM_EXPORT WebString remoteIPAddress() const;
BLINK_PLATFORM_EXPORT void setRemoteIPAddress(const WebString&);
BLINK_PLATFORM_EXPORT unsigned short remotePort() const;
BLINK_PLATFORM_EXPORT void setRemotePort(unsigned short);
BLINK_PLATFORM_EXPORT ExtraData* extraData() const;
BLINK_PLATFORM_EXPORT void setExtraData(ExtraData*);
protected:
BLINK_PLATFORM_EXPORT void assign(WebURLResponsePrivate*);
private:
WebURLResponsePrivate* m_private;
};
}
#endif