diff options
Diffstat (limited to 'webkit/api/public')
-rw-r--r-- | webkit/api/public/WebHTTPBody.h | 57 | ||||
-rw-r--r-- | webkit/api/public/WebHTTPHeaderVisitor.h | 44 | ||||
-rw-r--r-- | webkit/api/public/WebKitClient.h | 12 | ||||
-rw-r--r-- | webkit/api/public/WebNonCopyable.h | 49 | ||||
-rw-r--r-- | webkit/api/public/WebURL.h | 8 | ||||
-rw-r--r-- | webkit/api/public/WebURLError.h | 15 | ||||
-rw-r--r-- | webkit/api/public/WebURLLoader.h | 14 | ||||
-rw-r--r-- | webkit/api/public/WebURLLoaderClient.h | 24 | ||||
-rw-r--r-- | webkit/api/public/WebURLRequest.h | 84 | ||||
-rw-r--r-- | webkit/api/public/WebURLResponse.h | 83 |
10 files changed, 283 insertions, 107 deletions
diff --git a/webkit/api/public/WebHTTPBody.h b/webkit/api/public/WebHTTPBody.h index 1a4f49c..59a008d 100644 --- a/webkit/api/public/WebHTTPBody.h +++ b/webkit/api/public/WebHTTPBody.h @@ -1,10 +1,10 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above @@ -14,7 +14,7 @@ * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -31,23 +31,62 @@ #ifndef WebHTTPBody_h #define WebHTTPBody_h -#error "This header file is still a work in progress; do not include!" - #include "WebData.h" +#include "WebNonCopyable.h" #include "WebString.h" -#include "WebVector.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class FormData; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif namespace WebKit { + class WebHTTPBodyPrivate; - struct WebHTTPBody { + class WebHTTPBody : public WebNonCopyable { + public: struct Element { enum { TypeData, TypeFile } type; WebData data; - WebString fileName; + WebString filePath; }; - WebVector<Element> elements; + + ~WebHTTPBody() { reset(); } + + WebHTTPBody() : m_private(0) { } + + bool isNull() const { return m_private == 0; } + + WEBKIT_API void initialize(); + WEBKIT_API void reset(); + + // Returns the number of elements comprising the http body. + WEBKIT_API size_t elementCount() const; + + // Sets the values of the element at the given index. Returns false if + // index is out of bounds. + WEBKIT_API bool elementAt(size_t index, Element&) const; + + // Append to the list of elements. + WEBKIT_API void appendData(const WebData&); + WEBKIT_API void appendFile(const WebString&); + + // Identifies a particular form submission instance. A value of 0 is + // used to indicate an unspecified identifier. + WEBKIT_API long long identifier() const; + WEBKIT_API void setIdentifier(long long); + +#if WEBKIT_IMPLEMENTATION + void rebind(WTF::PassRefPtr<WebCore::FormData>); + operator WTF::PassRefPtr<WebCore::FormData>() const; +#endif + + private: + void assign(WebHTTPBodyPrivate*); + WebHTTPBodyPrivate* m_private; }; + } // namespace WebKit #endif diff --git a/webkit/api/public/WebHTTPHeaderVisitor.h b/webkit/api/public/WebHTTPHeaderVisitor.h new file mode 100644 index 0000000..b61d3da --- /dev/null +++ b/webkit/api/public/WebHTTPHeaderVisitor.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebHTTPHeaderVisitor_h +#define WebHTTPHeaderVisitor_h + +namespace WebKit { + class WebString; + + class WebHTTPHeaderVisitor { + public: + virtual void visitHeader(const WebString& name, const WebString& value) = 0; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebKitClient.h b/webkit/api/public/WebKitClient.h index 5b136d5..7dc158a 100644 --- a/webkit/api/public/WebKitClient.h +++ b/webkit/api/public/WebKitClient.h @@ -1,10 +1,10 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above @@ -14,7 +14,7 @@ * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -42,6 +42,7 @@ namespace WebKit { class WebString; class WebThemeEngine; class WebURL; + class WebURLLoader; struct WebPluginInfo; template <typename T> class WebVector; @@ -71,7 +72,7 @@ namespace WebKit { // hash must have been generated by calling VisitedLinkHash(). virtual bool isLinkVisited(unsigned long long linkHash) = 0; - + // Network ------------------------------------------------------------- virtual void setCookies( @@ -81,6 +82,9 @@ namespace WebKit { // A suggestion to prefetch IP information for the given hostname. virtual void prefetchHostName(const WebString&) = 0; + // Returns a new WebURLLoader instance. + virtual WebURLLoader* createURLLoader() = 0; + // Plugins ------------------------------------------------------------- diff --git a/webkit/api/public/WebNonCopyable.h b/webkit/api/public/WebNonCopyable.h new file mode 100644 index 0000000..df4b482 --- /dev/null +++ b/webkit/api/public/WebNonCopyable.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebNonCopyable_h +#define WebNonCopyable_h + +namespace WebKit { + + // A base class to extend from if you do not support copying. + class WebNonCopyable { + protected: + WebNonCopyable() { } + ~WebNonCopyable() { } + + private: + WebNonCopyable(const WebNonCopyable&); + WebNonCopyable& operator=(const WebNonCopyable&); + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebURL.h b/webkit/api/public/WebURL.h index aad9281..ae833f5 100644 --- a/webkit/api/public/WebURL.h +++ b/webkit/api/public/WebURL.h @@ -1,10 +1,10 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above @@ -14,7 +14,7 @@ * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -128,7 +128,7 @@ namespace WebKit { operator GURL() const { - return GURL(m_spec.data(), m_spec.length(), m_parsed, m_isValid); + return isNull() ? GURL() : GURL(m_spec.data(), m_spec.length(), m_parsed, m_isValid); } #endif diff --git a/webkit/api/public/WebURLError.h b/webkit/api/public/WebURLError.h index 6332b5e..d1a92e9 100644 --- a/webkit/api/public/WebURLError.h +++ b/webkit/api/public/WebURLError.h @@ -1,10 +1,10 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above @@ -14,7 +14,7 @@ * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -31,8 +31,6 @@ #ifndef WebURLError_h #define WebURLError_h -#error "This header file is still a work in progress; do not include!" - #include "WebString.h" #include "WebURL.h" @@ -48,9 +46,10 @@ namespace WebKit { // string as it will just be passed via callbacks to the consumer. WebString domain; - // A numeric reason for the error. WebKit does not care about the - // value of this field as it will just be passed via callbacks to the - // consumer. + // A numeric error code detailing the reason for this error. A value + // of 0 means no error. WebKit does not interpret the meaning of other + // values and normally just forwards this error information back to the + // embedder (see for example WebFrameClient). int reason; // The url that failed to load. diff --git a/webkit/api/public/WebURLLoader.h b/webkit/api/public/WebURLLoader.h index 721fe60..e9027c4 100644 --- a/webkit/api/public/WebURLLoader.h +++ b/webkit/api/public/WebURLLoader.h @@ -1,10 +1,10 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above @@ -14,7 +14,7 @@ * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -31,16 +31,14 @@ #ifndef WebURLLoader_h #define WebURLLoader_h -#error "This header file is still a work in progress; do not include!" - #include "WebCommon.h" namespace WebKit { - class WebCString; - class WebURLError; + class WebData; class WebURLLoaderClient; class WebURLRequest; class WebURLResponse; + struct WebURLError; class WebURLLoader { public: @@ -50,7 +48,7 @@ namespace WebKit { // caller upon completion. There is no mechanism to interrupt a // synchronous load!! virtual void loadSynchronously(const WebURLRequest&, - WebURLResponse&, WebURLError&, WebCString& data) = 0; + WebURLResponse&, WebURLError&, WebData& data) = 0; // Load the request asynchronously, sending notifications to the given // client. The client will receive no further notifications if the diff --git a/webkit/api/public/WebURLLoaderClient.h b/webkit/api/public/WebURLLoaderClient.h index 3a0a761..5e7d4e2 100644 --- a/webkit/api/public/WebURLLoaderClient.h +++ b/webkit/api/public/WebURLLoaderClient.h @@ -1,10 +1,10 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above @@ -14,7 +14,7 @@ * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -31,33 +31,35 @@ #ifndef WebURLLoaderClient_h #define WebURLLoaderClient_h -#error "This header file is still a work in progress; do not include!" - namespace WebKit { + class WebURLLoader; + class WebURLRequest; + class WebURLResponse; + struct WebURLError; class WebURLLoaderClient { public: // Called when following a redirect. |newRequest| contains the request // generated by the redirect. The client may modify |newRequest|. virtual void willSendRequest( - WebURLRequest& newRequest, const WebURLResponse& redirectResponse) = 0; + WebURLLoader*, WebURLRequest& newRequest, const WebURLResponse& redirectResponse) = 0; // Called to report upload progress. The bytes reported correspond to // the HTTP message body. virtual void didSendData( - unsigned long long bytesSent, unsigned long long totalBytesToBeSent) = 0; + WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) = 0; // Called when response headers are received. - virtual void didReceiveResponse(const WebURLResponse&) = 0; + virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&) = 0; // Called when a chunk of response data is received. - virtual void didReceiveData(const char* data, int dataLength, int totalDataLength) = 0; + virtual void didReceiveData(WebURLLoader*, const char* data, int dataLength, long long totalDataLength) = 0; // Called when the load completes successfully. - virtual void didFinishLoading() = 0; + virtual void didFinishLoading(WebURLLoader*) = 0; // Called when the load completes with an error. - virtual void didFail(const WebURLError&) = 0; + virtual void didFail(WebURLLoader*, const WebURLError&) = 0; }; } // namespace WebKit diff --git a/webkit/api/public/WebURLRequest.h b/webkit/api/public/WebURLRequest.h index c7b9bec..5e4ee07 100644 --- a/webkit/api/public/WebURLRequest.h +++ b/webkit/api/public/WebURLRequest.h @@ -1,10 +1,10 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above @@ -14,7 +14,7 @@ * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -31,14 +31,17 @@ #ifndef WebURLRequest_h #define WebURLRequest_h -#error "This header file is still a work in progress; do not include!" - #include "WebCommon.h" #include "WebHTTPBody.h" +#if defined(WEBKIT_IMPLEMENTATION) +namespace WebCore { struct ResourceRequest; } +#endif + namespace WebKit { class WebCString; class WebHTTPBody; + class WebHTTPHeaderVisitor; class WebString; class WebURL; class WebURLRequestPrivate; @@ -66,58 +69,75 @@ namespace WebKit { WebURLRequest(const WebURLRequest& r) : m_private(0) { assign(r); } WebURLRequest& operator=(const WebURLRequest& r) { assign(r); return *this; } + explicit WebURLRequest(const WebURL& url) : m_private(0) + { + initialize(); + setURL(url); + } + WEBKIT_API void initialize(); WEBKIT_API void reset(); WEBKIT_API void assign(const WebURLRequest&); bool isNull() const { return m_private == 0; } - WEBKIT_API WebURL url() const = 0; - WEBKIT_API void setURL(const WebURL&) = 0; + WEBKIT_API WebURL url() const; + WEBKIT_API void setURL(const WebURL&); // Used to implement third-party cookie blocking. - WEBKIT_API WebURL firstPartyForCookies() const = 0; - WEBKIT_API void setFirstPartyForCookies(const WebURL&) = 0; + WEBKIT_API WebURL firstPartyForCookies() const; + WEBKIT_API void setFirstPartyForCookies(const WebURL&); + + WEBKIT_API CachePolicy cachePolicy() const; + WEBKIT_API void setCachePolicy(CachePolicy); - WEBKIT_API CachePolicy cachePolicy() const = 0; - WEBKIT_API void setCachePolicy(CachePolicy) = 0; + WEBKIT_API WebString httpMethod() const; + WEBKIT_API void setHTTPMethod(const WebString&); - WEBKIT_API WebString httpMethod() const = 0; - WEBKIT_API void setHTTPMethod(const WebString&) = 0; + WEBKIT_API WebString httpHeaderField(const WebString& name) const; + WEBKIT_API void setHTTPHeaderField(const WebString& name, const WebString& value); + WEBKIT_API void addHTTPHeaderField(const WebString& name, const WebString& value); + WEBKIT_API void clearHTTPHeaderField(const WebString& name); + WEBKIT_API void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) const; - WEBKIT_API WebString httpHeaderField(const WebString& name) const = 0; - WEBKIT_API void setHTTPHeaderField(const WebString& name, const WebString& value) = 0; - WEBKIT_API void addHTTPHeaderField(const WebString& name, const WebString& value) = 0; - WEBKIT_API void clearHTTPHeaderField(const WebString& name) = 0; + WEBKIT_API const WebHTTPBody& httpBody() const; + WEBKIT_API void setHTTPBody(const WebHTTPBody&); - WEBKIT_API bool hasHTTPBody() const = 0; - WEBKIT_API void httpBody(WebHTTPBody&) const = 0; - WEBKIT_API void setHTTPBody(const WebHTTPBody&) = 0; - WEBKIT_API void appendToHTTPBody(const WebHTTPBody::Element&) = 0; - // Controls whether upload progress events are generated when a request // has a body. - WEBKIT_API bool reportUploadProgress() const = 0; - WEBKIT_API void setReportUploadProgress(bool) = 0; + WEBKIT_API bool reportUploadProgress() const; + WEBKIT_API void setReportUploadProgress(bool); - WEBKIT_API TargetType targetType() const = 0; - WEBKIT_API void setTargetType(const TargetType&) = 0; + WEBKIT_API TargetType targetType() const; + WEBKIT_API void setTargetType(TargetType); // A consumer controlled value intended to be used to identify the // requestor. - WEBKIT_API int requestorID() const = 0; - WEBKIT_API void setRequestorID(int) = 0; + WEBKIT_API int requestorID() const; + WEBKIT_API void setRequestorID(int); // A consumer controlled value intended to be used to identify the // process of the requestor. - WEBKIT_API int requestorProcessID() const = 0; - WEBKIT_API void setRequestorProcessID(int) = 0; + WEBKIT_API int requestorProcessID() const; + WEBKIT_API void setRequestorProcessID(int); + + // Allows the request to be matched up with its app cache context. + WEBKIT_API int appCacheContextID() const; + WEBKIT_API void setAppCacheContextID(int id); // A consumer controlled value intended to be used to record opaque // security info related to this request. // FIXME: This really doesn't belong here! - WEBKIT_API WebCString securityInfo() const = 0; - WEBKIT_API void setSecurityInfo(const WebCString&) = 0; + WEBKIT_API WebCString securityInfo() const; + WEBKIT_API void setSecurityInfo(const WebCString&); + +#if defined(WEBKIT_IMPLEMENTATION) + WebCore::ResourceRequest& toMutableResourceRequest(); + const WebCore::ResourceRequest& toResourceRequest() const; +#endif + + protected: + void assign(WebURLRequestPrivate*); private: WebURLRequestPrivate* m_private; diff --git a/webkit/api/public/WebURLResponse.h b/webkit/api/public/WebURLResponse.h index 30d2641..2e1429f 100644 --- a/webkit/api/public/WebURLResponse.h +++ b/webkit/api/public/WebURLResponse.h @@ -1,10 +1,10 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above @@ -14,7 +14,7 @@ * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -31,12 +31,15 @@ #ifndef WebURLResponse_h #define WebURLResponse_h -#error "This header file is still a work in progress; do not include!" - #include "WebCommon.h" +#if defined(WEBKIT_IMPLEMENTATION) +namespace WebCore { class ResourceResponse; } +#endif + namespace WebKit { class WebCString; + class WebHTTPHeaderVisitor; class WebString; class WebURL; class WebURLResponsePrivate; @@ -49,51 +52,69 @@ namespace WebKit { 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); + } + WEBKIT_API void initialize(); WEBKIT_API void reset(); WEBKIT_API void assign(const WebURLResponse&); bool isNull() const { return m_private == 0; } - WEBKIT_API WebURL url() const = 0; - WEBKIT_API void setURL(const WebURL&) = 0; + WEBKIT_API WebURL url() const; + WEBKIT_API void setURL(const WebURL&); - WEBKIT_API WebString mimeType() const = 0; - WEBKIT_API void setMIMEType(const WebString&) = 0; + WEBKIT_API WebString mimeType() const; + WEBKIT_API void setMIMEType(const WebString&); - WEBKIT_API long long expectedContentLength() const = 0; - WEBKIT_API void setExpectedContentLength(long long) = 0; + WEBKIT_API long long expectedContentLength() const; + WEBKIT_API void setExpectedContentLength(long long); - WEBKIT_API WebString textEncodingName() const = 0; - WEBKIT_API void setTextEncodingName(const WebString&) = 0; + WEBKIT_API WebString textEncodingName() const; + WEBKIT_API void setTextEncodingName(const WebString&); - WEBKIT_API WebString suggestedFileName() const = 0; - WEBKIT_API void setSuggestedFileName(const WebString&) = 0; + WEBKIT_API WebString suggestedFileName() const; + WEBKIT_API void setSuggestedFileName(const WebString&); - WEBKIT_API int httpStatusCode() const = 0; - WEBKIT_API void setHTTPStatusCode(int) = 0; + WEBKIT_API int httpStatusCode() const; + WEBKIT_API void setHTTPStatusCode(int); - WEBKIT_API WebString httpStatusText() const = 0; - WEBKIT_API void setHTTPStatusText(const WebString&) = 0; + WEBKIT_API WebString httpStatusText() const; + WEBKIT_API void setHTTPStatusText(const WebString&); - WEBKIT_API WebString httpHeaderField(const WebString& name) const = 0; - WEBKIT_API void setHTTPHeaderField(const WebString& name, const WebString& value) = 0; - WEBKIT_API void addHTTPHeaderField(const WebString& name, const WebString& value) = 0; - WEBKIT_API void clearHTTPHeaderField(const WebString& name) = 0; + WEBKIT_API WebString httpHeaderField(const WebString& name) const; + WEBKIT_API void setHTTPHeaderField(const WebString& name, const WebString& value); + WEBKIT_API void addHTTPHeaderField(const WebString& name, const WebString& value); + WEBKIT_API void clearHTTPHeaderField(const WebString& name); + WEBKIT_API void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) const; - WEBKIT_API double expirationDate() const = 0; - WEBKIT_API void setExpirationDate(double) = 0; + WEBKIT_API double expirationDate() const; + WEBKIT_API void setExpirationDate(double); - WEBKIT_API double lastModifiedDate() const = 0; - WEBKIT_API void setLastModifiedDate(double) = 0; + WEBKIT_API double lastModifiedDate() const; + WEBKIT_API void setLastModifiedDate(double); - WEBKIT_API bool isContentFiltered() const = 0; - WEBKIT_API void setIsContentFiltered(bool) = 0; + WEBKIT_API bool isContentFiltered() const; + WEBKIT_API void setIsContentFiltered(bool); + + WEBKIT_API long long appCacheID() const; + WEBKIT_API void setAppCacheID(long long); // A consumer controlled value intended to be used to record opaque // security info related to this request. - WEBKIT_API WebCString securityInfo() const = 0; - WEBKIT_API void setSecurityInfo(const WebCString&) = 0; + WEBKIT_API WebCString securityInfo() const; + WEBKIT_API void setSecurityInfo(const WebCString&); + +#if defined(WEBKIT_IMPLEMENTATION) + WebCore::ResourceResponse& toMutableResourceResponse(); + const WebCore::ResourceResponse& toResourceResponse() const; +#endif + + protected: + void assign(WebURLResponsePrivate*); private: WebURLResponsePrivate* m_private; |