diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-30 22:42:58 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-30 22:42:58 +0000 |
commit | eed529ce5d09706bc2b9da5b96822eda2919a9ae (patch) | |
tree | f5afad43a1e8412ed9473fa9d7e418621373decd /webkit/api | |
parent | ee8f54a54cab5cc3eaf837622ec61b482fac8858 (diff) | |
download | chromium_src-eed529ce5d09706bc2b9da5b96822eda2919a9ae.zip chromium_src-eed529ce5d09706bc2b9da5b96822eda2919a9ae.tar.gz chromium_src-eed529ce5d09706bc2b9da5b96822eda2919a9ae.tar.bz2 |
Revert WebURLLoader landing. Too many layout test failures.
TBR=dglazkov
Review URL: http://codereview.chromium.org/115973
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17293 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/api')
-rw-r--r-- | webkit/api/public/WebHTTPBody.h | 51 | ||||
-rw-r--r-- | webkit/api/public/WebHTTPHeaderVisitor.h | 44 | ||||
-rw-r--r-- | webkit/api/public/WebKitClient.h | 4 | ||||
-rw-r--r-- | webkit/api/public/WebNonCopyable.h | 49 | ||||
-rw-r--r-- | webkit/api/public/WebURL.h | 2 | ||||
-rw-r--r-- | webkit/api/public/WebURLError.h | 9 | ||||
-rw-r--r-- | webkit/api/public/WebURLLoader.h | 8 | ||||
-rw-r--r-- | webkit/api/public/WebURLLoaderClient.h | 18 | ||||
-rw-r--r-- | webkit/api/public/WebURLRequest.h | 78 | ||||
-rw-r--r-- | webkit/api/public/WebURLResponse.h | 77 | ||||
-rw-r--r-- | webkit/api/src/ResourceHandle.cpp | 279 | ||||
-rw-r--r-- | webkit/api/src/WebDragData.cpp | 5 | ||||
-rw-r--r-- | webkit/api/src/WebHTTPBody.cpp | 124 | ||||
-rw-r--r-- | webkit/api/src/WebURLError.cpp | 69 | ||||
-rw-r--r-- | webkit/api/src/WebURLRequest.cpp | 246 | ||||
-rw-r--r-- | webkit/api/src/WebURLRequestPrivate.h | 53 | ||||
-rw-r--r-- | webkit/api/src/WebURLResponse.cpp | 259 | ||||
-rw-r--r-- | webkit/api/src/WebURLResponsePrivate.h | 50 | ||||
-rw-r--r-- | webkit/api/src/WrappedResourceRequest.h | 67 | ||||
-rw-r--r-- | webkit/api/src/WrappedResourceResponse.h | 68 |
20 files changed, 86 insertions, 1474 deletions
diff --git a/webkit/api/public/WebHTTPBody.h b/webkit/api/public/WebHTTPBody.h index 06d37fe..1a4f49c 100644 --- a/webkit/api/public/WebHTTPBody.h +++ b/webkit/api/public/WebHTTPBody.h @@ -31,62 +31,23 @@ #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" - -#if WEBKIT_IMPLEMENTATION -namespace WebCore { class FormData; } -namespace WTF { template <typename T> class PassRefPtr; } -#endif +#include "WebVector.h" namespace WebKit { - class WebHTTPBodyPrivate; - class WebHTTPBody : public WebNonCopyable { - public: + struct WebHTTPBody { struct Element { enum { TypeData, TypeFile } type; WebData data; - WebString filePath; + WebString fileName; }; - - ~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; + WebVector<Element> elements; }; - } // namespace WebKit #endif diff --git a/webkit/api/public/WebHTTPHeaderVisitor.h b/webkit/api/public/WebHTTPHeaderVisitor.h deleted file mode 100644 index b61d3da..0000000 --- a/webkit/api/public/WebHTTPHeaderVisitor.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 87ff7b7e..5b136d5 100644 --- a/webkit/api/public/WebKitClient.h +++ b/webkit/api/public/WebKitClient.h @@ -42,7 +42,6 @@ namespace WebKit { class WebString; class WebThemeEngine; class WebURL; - class WebURLLoader; struct WebPluginInfo; template <typename T> class WebVector; @@ -82,9 +81,6 @@ 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 deleted file mode 100644 index df4b482..0000000 --- a/webkit/api/public/WebNonCopyable.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 f23f71b..aad9281 100644 --- a/webkit/api/public/WebURL.h +++ b/webkit/api/public/WebURL.h @@ -128,7 +128,7 @@ namespace WebKit { operator GURL() const { - return isNull() ? GURL() : GURL(m_spec.data(), m_spec.length(), m_parsed, m_isValid); + return 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 c4cfe46..6332b5e 100644 --- a/webkit/api/public/WebURLError.h +++ b/webkit/api/public/WebURLError.h @@ -31,6 +31,8 @@ #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" @@ -46,10 +48,9 @@ namespace WebKit { // string as it will just be passed via callbacks to the consumer. WebString domain; - // 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). + // 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. int reason; // The url that failed to load. diff --git a/webkit/api/public/WebURLLoader.h b/webkit/api/public/WebURLLoader.h index 8bc8a94..721fe60 100644 --- a/webkit/api/public/WebURLLoader.h +++ b/webkit/api/public/WebURLLoader.h @@ -31,14 +31,16 @@ #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 WebData; + class WebCString; + class WebURLError; class WebURLLoaderClient; class WebURLRequest; class WebURLResponse; - struct WebURLError; class WebURLLoader { public: @@ -48,7 +50,7 @@ namespace WebKit { // caller upon completion. There is no mechanism to interrupt a // synchronous load!! virtual void loadSynchronously(const WebURLRequest&, - WebURLResponse&, WebURLError&, WebData& data) = 0; + WebURLResponse&, WebURLError&, WebCString& 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 16ea87e..3a0a761 100644 --- a/webkit/api/public/WebURLLoaderClient.h +++ b/webkit/api/public/WebURLLoaderClient.h @@ -31,35 +31,33 @@ #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( - WebURLLoader*, WebURLRequest& newRequest, const WebURLResponse& redirectResponse) = 0; + WebURLRequest& newRequest, const WebURLResponse& redirectResponse) = 0; // Called to report upload progress. The bytes reported correspond to // the HTTP message body. virtual void didSendData( - WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) = 0; + unsigned long long bytesSent, unsigned long long totalBytesToBeSent) = 0; // Called when response headers are received. - virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&) = 0; + virtual void didReceiveResponse(const WebURLResponse&) = 0; // Called when a chunk of response data is received. - virtual void didReceiveData(WebURLLoader*, const char* data, int dataLength, long long totalDataLength) = 0; + virtual void didReceiveData(const char* data, int dataLength, int totalDataLength) = 0; // Called when the load completes successfully. - virtual void didFinishLoading(WebURLLoader*) = 0; + virtual void didFinishLoading() = 0; // Called when the load completes with an error. - virtual void didFail(WebURLLoader*, const WebURLError&) = 0; + virtual void didFail(const WebURLError&) = 0; }; } // namespace WebKit diff --git a/webkit/api/public/WebURLRequest.h b/webkit/api/public/WebURLRequest.h index 8399624..c7b9bec 100644 --- a/webkit/api/public/WebURLRequest.h +++ b/webkit/api/public/WebURLRequest.h @@ -31,17 +31,14 @@ #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; @@ -69,75 +66,58 @@ 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; - WEBKIT_API void setURL(const WebURL&); + WEBKIT_API WebURL url() const = 0; + WEBKIT_API void setURL(const WebURL&) = 0; // Used to implement third-party cookie blocking. - WEBKIT_API WebURL firstPartyForCookies() const; - WEBKIT_API void setFirstPartyForCookies(const WebURL&); - - WEBKIT_API CachePolicy cachePolicy() const; - WEBKIT_API void setCachePolicy(CachePolicy); + WEBKIT_API WebURL firstPartyForCookies() const = 0; + WEBKIT_API void setFirstPartyForCookies(const WebURL&) = 0; - WEBKIT_API WebString httpMethod() const; - WEBKIT_API void setHTTPMethod(const WebString&); + WEBKIT_API CachePolicy cachePolicy() const = 0; + WEBKIT_API void setCachePolicy(CachePolicy) = 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 httpMethod() const = 0; + WEBKIT_API void setHTTPMethod(const WebString&) = 0; - WEBKIT_API const WebHTTPBody& httpBody() const; - WEBKIT_API void setHTTPBody(const WebHTTPBody&); + 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 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; - WEBKIT_API void setReportUploadProgress(bool); + WEBKIT_API bool reportUploadProgress() const = 0; + WEBKIT_API void setReportUploadProgress(bool) = 0; - WEBKIT_API TargetType targetType() const; - WEBKIT_API void setTargetType(TargetType); + WEBKIT_API TargetType targetType() const = 0; + WEBKIT_API void setTargetType(const TargetType&) = 0; // A consumer controlled value intended to be used to identify the // requestor. - WEBKIT_API int requestorID() const; - WEBKIT_API void setRequestorID(int); + WEBKIT_API int requestorID() const = 0; + WEBKIT_API void setRequestorID(int) = 0; // A consumer controlled value intended to be used to identify the // process of the requestor. - 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); + WEBKIT_API int requestorProcessID() const = 0; + WEBKIT_API void setRequestorProcessID(int) = 0; // 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; - WEBKIT_API void setSecurityInfo(const WebCString&); - -#if defined(WEBKIT_IMPLEMENTATION) - WebCore::ResourceRequest& toMutableResourceRequest(); - const WebCore::ResourceRequest& toResourceRequest() const; -#endif - - protected: - void assign(WebURLRequestPrivate*); + WEBKIT_API WebCString securityInfo() const = 0; + WEBKIT_API void setSecurityInfo(const WebCString&) = 0; private: WebURLRequestPrivate* m_private; diff --git a/webkit/api/public/WebURLResponse.h b/webkit/api/public/WebURLResponse.h index c26f213..30d2641 100644 --- a/webkit/api/public/WebURLResponse.h +++ b/webkit/api/public/WebURLResponse.h @@ -31,15 +31,12 @@ #ifndef WebURLResponse_h #define WebURLResponse_h -#include "WebCommon.h" +#error "This header file is still a work in progress; do not include!" -#if defined(WEBKIT_IMPLEMENTATION) -namespace WebCore { class ResourceResponse; } -#endif +#include "WebCommon.h" namespace WebKit { class WebCString; - class WebHTTPHeaderVisitor; class WebString; class WebURL; class WebURLResponsePrivate; @@ -52,69 +49,51 @@ 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; - WEBKIT_API void setURL(const WebURL&); + WEBKIT_API WebURL url() const = 0; + WEBKIT_API void setURL(const WebURL&) = 0; - WEBKIT_API WebString mimeType() const; - WEBKIT_API void setMIMEType(const WebString&); + WEBKIT_API WebString mimeType() const = 0; + WEBKIT_API void setMIMEType(const WebString&) = 0; - WEBKIT_API long long expectedContentLength() const; - WEBKIT_API void setExpectedContentLength(long long); + WEBKIT_API long long expectedContentLength() const = 0; + WEBKIT_API void setExpectedContentLength(long long) = 0; - WEBKIT_API WebString textEncodingName() const; - WEBKIT_API void setTextEncodingName(const WebString&); + WEBKIT_API WebString textEncodingName() const = 0; + WEBKIT_API void setTextEncodingName(const WebString&) = 0; - WEBKIT_API WebString suggestedFileName() const; - WEBKIT_API void setSuggestedFileName(const WebString&); + WEBKIT_API WebString suggestedFileName() const = 0; + WEBKIT_API void setSuggestedFileName(const WebString&) = 0; - WEBKIT_API int httpStatusCode() const; - WEBKIT_API void setHTTPStatusCode(int); + WEBKIT_API int httpStatusCode() const = 0; + WEBKIT_API void setHTTPStatusCode(int) = 0; - WEBKIT_API WebString httpStatusText() const; - WEBKIT_API void setHTTPStatusText(const WebString&); + WEBKIT_API WebString httpStatusText() const = 0; + WEBKIT_API void setHTTPStatusText(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 double expirationDate() const; - WEBKIT_API void setExpirationDate(double); + WEBKIT_API double expirationDate() const = 0; + WEBKIT_API void setExpirationDate(double) = 0; - WEBKIT_API double lastModifiedDate() const; - WEBKIT_API void setLastModifiedDate(double); + WEBKIT_API double lastModifiedDate() const = 0; + WEBKIT_API void setLastModifiedDate(double) = 0; - WEBKIT_API bool isContentFiltered() const; - WEBKIT_API void setIsContentFiltered(bool); - - WEBKIT_API long long appCacheID() const; - WEBKIT_API void setAppCacheID(long long); + WEBKIT_API bool isContentFiltered() const = 0; + WEBKIT_API void setIsContentFiltered(bool) = 0; // A consumer controlled value intended to be used to record opaque // security info related to this request. - 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*); + WEBKIT_API WebCString securityInfo() const = 0; + WEBKIT_API void setSecurityInfo(const WebCString&) = 0; private: WebURLResponsePrivate* m_private; diff --git a/webkit/api/src/ResourceHandle.cpp b/webkit/api/src/ResourceHandle.cpp deleted file mode 100644 index b7def8d..0000000 --- a/webkit/api/src/ResourceHandle.cpp +++ /dev/null @@ -1,279 +0,0 @@ -/* - * 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. - */ - -#include "config.h" -#include "ResourceHandle.h" - -#include "WebKit.h" -#include "WebKitClient.h" -#include "WebURLError.h" -#include "WebURLLoader.h" -#include "WebURLLoaderClient.h" -#include "WebURLRequest.h" -#include "WebURLResponse.h" -#include "WrappedResourceRequest.h" -#include "WrappedResourceResponse.h" - -#include "ResourceHandleClient.h" -#include "ResourceRequest.h" - -using namespace WebKit; - -namespace WebCore { - -// ResourceHandleInternal ----------------------------------------------------- - -class ResourceHandleInternal : public WebURLLoaderClient { -public: - ResourceHandleInternal(const ResourceRequest& request, ResourceHandleClient* client) - : m_request(request) - , m_owner(0) - , m_client(client) - { - } - - void start(); - void cancel(); - void setDefersLoading(bool); - - // WebURLLoaderClient methods: - virtual void willSendRequest(WebURLLoader*, WebURLRequest&, const WebURLResponse&); - virtual void didSendData( - WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent); - virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&); - virtual void didReceiveData( - WebURLLoader*, const char* data, int dataLength, long long totalDataLength); - virtual void didFinishLoading(WebURLLoader*); - virtual void didFail(WebURLLoader*, const WebURLError&); - - ResourceRequest m_request; - ResourceHandle* m_owner; - ResourceHandleClient* m_client; - OwnPtr<WebURLLoader> m_loader; -}; - -void ResourceHandleInternal::start() -{ - m_loader.set(webKitClient()->createURLLoader()); - ASSERT(m_loader.get()); - - WrappedResourceRequest wrappedRequest(m_request); - m_loader->loadAsynchronously(wrappedRequest, this); -} - -void ResourceHandleInternal::cancel() -{ - m_loader->cancel(); - - // Do not make any further calls to the client. - m_client = 0; -} - -void ResourceHandleInternal::setDefersLoading(bool value) -{ - m_loader->setDefersLoading(value); -} - -void ResourceHandleInternal::willSendRequest( - WebURLLoader*, WebURLRequest& request, const WebURLResponse& response) -{ - ASSERT(m_client); - ASSERT(!request.isNull()); - ASSERT(!response.isNull()); - m_client->willSendRequest(m_owner, request.toMutableResourceRequest(), response.toResourceResponse()); -} - -void ResourceHandleInternal::didSendData( - WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) -{ - ASSERT(m_client); - m_client->didSendData(m_owner, bytesSent, totalBytesToBeSent); -} - -void ResourceHandleInternal::didReceiveResponse(WebURLLoader*, const WebURLResponse& response) -{ - ASSERT(m_client); - ASSERT(!response.isNull()); - m_client->didReceiveResponse(m_owner, response.toResourceResponse()); -} - -void ResourceHandleInternal::didReceiveData( - WebURLLoader*, const char* data, int dataLength, long long totalDataLength) -{ - ASSERT(m_client); - - // FIXME: ResourceHandleClient::didReceiveData should take a 'long long' - int lengthReceived = static_cast<int>(totalDataLength); - if (lengthReceived != totalDataLength) // overflow occurred - lengthReceived = -1; - - m_client->didReceiveData(m_owner, data, dataLength, lengthReceived); -} - -void ResourceHandleInternal::didFinishLoading(WebURLLoader*) -{ - ASSERT(m_client); - m_client->didFinishLoading(m_owner); -} - -void ResourceHandleInternal::didFail(WebURLLoader*, const WebURLError& error) -{ - ASSERT(m_client); - m_client->didFail(m_owner, error); -} - -// ResourceHandle ------------------------------------------------------------- - -ResourceHandle::ResourceHandle(const ResourceRequest& request, - ResourceHandleClient* client, - bool defersLoading, - bool shouldContentSniff, - bool mightDownloadFromHandle) - : d(new ResourceHandleInternal(request, client)) -{ - d->m_owner = this; - - // FIXME: Figure out what to do with the bool params. -} - -PassRefPtr<ResourceHandle> ResourceHandle::create(const ResourceRequest& request, - ResourceHandleClient* client, - Frame* deprecated, - bool defersLoading, - bool shouldContentSniff, - bool mightDownloadFromHandle) -{ - RefPtr<ResourceHandle> newHandle = adoptRef(new ResourceHandle( - request, client, defersLoading, shouldContentSniff, mightDownloadFromHandle)); - - if (newHandle->start(deprecated)) - return newHandle.release(); - - return 0; -} - -const ResourceRequest& ResourceHandle::request() const -{ - return d->m_request; -} - -ResourceHandleClient* ResourceHandle::client() const -{ - return d->m_client; -} - -void ResourceHandle::setClient(ResourceHandleClient* client) -{ - d->m_client = client; -} - -void ResourceHandle::setDefersLoading(bool value) -{ - d->setDefersLoading(value); -} - -bool ResourceHandle::start(Frame* deprecated) -{ - d->start(); - return true; -} - -void ResourceHandle::clearAuthentication() -{ -} - -void ResourceHandle::cancel() -{ - d->cancel(); -} - -ResourceHandle::~ResourceHandle() -{ - d->m_owner = 0; -} - -PassRefPtr<SharedBuffer> ResourceHandle::bufferedData() -{ - return 0; -} - -bool ResourceHandle::loadsBlocked() -{ - return false; // This seems to be related to sync XMLHttpRequest... -} - -// static -bool ResourceHandle::supportsBufferedData() -{ - return false; // The loader will buffer manually if it needs to. -} - -// static -void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, - StoredCredentials unused, - ResourceError& error, - ResourceResponse& response, - Vector<char>& data, - Frame* deprecated) -{ - OwnPtr<WebURLLoader> loader(webKitClient()->createURLLoader()); - ASSERT(loader.get()); - - WrappedResourceRequest requestIn(request); - WrappedResourceResponse responseOut(response); - WebURLError errorOut; - WebData dataOut; - - loader->loadSynchronously(requestIn, responseOut, errorOut, dataOut); - - error = errorOut; - data.clear(); - data.append(dataOut.data(), dataOut.size()); -} - -// static -bool ResourceHandle::willLoadFromCache(ResourceRequest& request) -{ - // This method is used to determine if a POST request can be repeated from - // cache, but you cannot really know until you actually try to read from the - // cache. Even if we checked now, something else could come along and wipe - // out the cache entry by the time we fetch it. - // - // So, we always say yes here, which allows us to generate an ERR_CACHE_MISS - // if the request cannot be serviced from cache. We force the 'DontLoad' - // cache policy at this point to ensure that we never hit the network for - // this request. - // - ASSERT(request.httpMethod() == "POST"); - request.setCachePolicy(ReturnCacheDataDontLoad); - return true; -} - -} // namespace WebCore diff --git a/webkit/api/src/WebDragData.cpp b/webkit/api/src/WebDragData.cpp index a8210ac..426ceea 100644 --- a/webkit/api/src/WebDragData.cpp +++ b/webkit/api/src/WebDragData.cpp @@ -53,7 +53,10 @@ void WebDragData::initialize() void WebDragData::reset() { - assign(0); + if (m_private) { + m_private->deref(); + m_private = 0; + } } void WebDragData::assign(const WebDragData& other) diff --git a/webkit/api/src/WebHTTPBody.cpp b/webkit/api/src/WebHTTPBody.cpp deleted file mode 100644 index 69875e7..0000000 --- a/webkit/api/src/WebHTTPBody.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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. - */ - -#include "config.h" -#include "WebHTTPBody.h" - -#include "FormData.h" - -using namespace WebCore; - -namespace WebKit { - -class WebHTTPBodyPrivate : public FormData { -}; - -void WebHTTPBody::initialize() -{ - assign(static_cast<WebHTTPBodyPrivate*>(FormData::create().releaseRef())); -} - -void WebHTTPBody::reset() -{ - assign(0); -} - -size_t WebHTTPBody::elementCount() const -{ - return m_private->elements().size(); -} - -bool WebHTTPBody::elementAt(size_t index, Element& result) const -{ - if (index >= m_private->elements().size()) - return false; - - const FormDataElement& element = m_private->elements()[index]; - - switch (element.m_type) { - case FormDataElement::data: - result.type = Element::TypeData; - result.data.assign(element.m_data.data(), element.m_data.size()); - result.filePath.reset(); - break; - case FormDataElement::encodedFile: - result.type = Element::TypeFile; - result.data.reset(); - result.filePath = element.m_filename; - break; - default: - ASSERT_NOT_REACHED(); - return false; - } - - return true; -} - -void WebHTTPBody::appendData(const WebData& data) -{ - // FIXME: FormDataElement::m_data should be a SharedBuffer<char>. Then we - // could avoid this buffer copy. - m_private->appendData(data.data(), data.size()); -} - -void WebHTTPBody::appendFile(const WebString& filePath) -{ - m_private->appendFile(filePath); -} - -long long WebHTTPBody::identifier() const -{ - return m_private->identifier(); -} - -void WebHTTPBody::setIdentifier(long long identifier) -{ - return m_private->setIdentifier(identifier); -} - -void WebHTTPBody::rebind(PassRefPtr<FormData> formData) -{ - assign(static_cast<WebHTTPBodyPrivate*>(formData.releaseRef())); -} - -WebHTTPBody::operator PassRefPtr<FormData>() const -{ - return m_private; -} - -void WebHTTPBody::assign(WebHTTPBodyPrivate* p) -{ - // p is already ref'd for us by the caller - if (m_private) - m_private->deref(); - m_private = p; -} - -} // namespace WebKit diff --git a/webkit/api/src/WebURLError.cpp b/webkit/api/src/WebURLError.cpp deleted file mode 100644 index cd7d72d..0000000 --- a/webkit/api/src/WebURLError.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ - -#include "config.h" -#include "WebURLError.h" - -#include "CString.h" -#include "KURL.h" -#include "ResourceError.h" - -using namespace WebCore; - -namespace WebKit { - -WebURLError::WebURLError(const ResourceError& error) -{ - *this = error; -} - -WebURLError& WebURLError::operator=(const ResourceError& error) -{ - if (error.isNull()) - *this = WebURLError(); - else { - domain = error.domain(); - reason = error.errorCode(); - unreachableURL = KURL(error.failingURL()); - } - return *this; -} - -WebURLError::operator ResourceError() const -{ - if (reason == 0) - return ResourceError(); - CString spec = unreachableURL.spec(); - return ResourceError(domain, reason, - String::fromUTF8(spec.data(), spec.length()), - String()); -} - -} // namespace WebKit diff --git a/webkit/api/src/WebURLRequest.cpp b/webkit/api/src/WebURLRequest.cpp deleted file mode 100644 index 66483f9..0000000 --- a/webkit/api/src/WebURLRequest.cpp +++ /dev/null @@ -1,246 +0,0 @@ -/* - * 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. - */ - -#include "config.h" -#include "WebURLRequest.h" - -#include "WebHTTPHeaderVisitor.h" -#include "WebURL.h" -#include "WebURLRequestPrivate.h" - -#include "ResourceRequest.h" - -using namespace WebCore; - -namespace WebKit { - -// The standard implementation of WebURLRequestPrivate, which maintains -// ownership of a ResourceRequest instance. -class WebURLRequestPrivateImpl : public WebURLRequestPrivate { -public: - WebURLRequestPrivateImpl() - { - m_resourceRequest = &m_resourceRequestAllocation; - } - - WebURLRequestPrivateImpl(const WebURLRequestPrivate* p) - : m_resourceRequestAllocation(*p->m_resourceRequest) - { - m_resourceRequest = &m_resourceRequestAllocation; - } - - virtual void dispose() { delete this; } - - ResourceRequest m_resourceRequestAllocation; -}; - -void WebURLRequest::initialize() -{ - assign(new WebURLRequestPrivateImpl()); -} - -void WebURLRequest::reset() -{ - assign(0); -} - -void WebURLRequest::assign(const WebURLRequest& r) -{ - assign(r.m_private ? new WebURLRequestPrivateImpl(r.m_private) : 0); -} - -WebURL WebURLRequest::url() const -{ - return m_private->m_resourceRequest->url(); -} - -void WebURLRequest::setURL(const WebURL& url) -{ - m_private->m_resourceRequest->setURL(url); -} - -WebURL WebURLRequest::firstPartyForCookies() const -{ - return m_private->m_resourceRequest->firstPartyForCookies(); -} - -void WebURLRequest::setFirstPartyForCookies(const WebURL& firstPartyForCookies) -{ - m_private->m_resourceRequest->setFirstPartyForCookies(firstPartyForCookies); -} - -WebURLRequest::CachePolicy WebURLRequest::cachePolicy() const -{ - return static_cast<WebURLRequest::CachePolicy>( - m_private->m_resourceRequest->cachePolicy()); -} - -void WebURLRequest::setCachePolicy(CachePolicy cachePolicy) -{ - m_private->m_resourceRequest->setCachePolicy( - static_cast<ResourceRequestCachePolicy>(cachePolicy)); -} - -WebString WebURLRequest::httpMethod() const -{ - return m_private->m_resourceRequest->httpMethod(); -} - -void WebURLRequest::setHTTPMethod(const WebString& httpMethod) -{ - m_private->m_resourceRequest->setHTTPMethod(httpMethod); -} - -WebString WebURLRequest::httpHeaderField(const WebString& name) const -{ - return m_private->m_resourceRequest->httpHeaderField(String(name)); -} - -void WebURLRequest::setHTTPHeaderField(const WebString& name, const WebString& value) -{ - m_private->m_resourceRequest->setHTTPHeaderField(String(name), value); -} - -void WebURLRequest::addHTTPHeaderField(const WebString& name, const WebString& value) -{ - m_private->m_resourceRequest->addHTTPHeaderField(String(name), value); -} - -void WebURLRequest::clearHTTPHeaderField(const WebString& name) -{ - // FIXME: Add a clearHTTPHeaderField method to ResourceRequest. - const HTTPHeaderMap& map = m_private->m_resourceRequest->httpHeaderFields(); - const_cast<HTTPHeaderMap*>(&map)->remove(String(name)); -} - -void WebURLRequest::visitHTTPHeaderFields(WebHTTPHeaderVisitor* visitor) const -{ - const HTTPHeaderMap& map = m_private->m_resourceRequest->httpHeaderFields(); - for (HTTPHeaderMap::const_iterator it = map.begin(); it != map.end(); ++it) - visitor->visitHeader(String(it->first), it->second); -} - -const WebHTTPBody& WebURLRequest::httpBody() const -{ - m_private->m_httpBody.rebind(m_private->m_resourceRequest->httpBody()); - return m_private->m_httpBody; -} - -void WebURLRequest::setHTTPBody(const WebHTTPBody& httpBody) -{ - m_private->m_resourceRequest->setHTTPBody(httpBody); - m_private->m_httpBody.rebind(0); // Free memory of the old body -} - -bool WebURLRequest::reportUploadProgress() const -{ - return m_private->m_resourceRequest->reportUploadProgress(); -} - -void WebURLRequest::setReportUploadProgress(bool reportUploadProgress) -{ - m_private->m_resourceRequest->setReportUploadProgress(reportUploadProgress); -} - -WebURLRequest::TargetType WebURLRequest::targetType() const -{ - return static_cast<TargetType>(m_private->m_resourceRequest->targetType()); -} - -void WebURLRequest::setTargetType(TargetType targetType) -{ - m_private->m_resourceRequest->setTargetType( - static_cast<ResourceRequest::TargetType>(targetType)); -} - -int WebURLRequest::requestorID() const -{ - return m_private->m_resourceRequest->requestorID(); -} - -void WebURLRequest::setRequestorID(int requestorID) -{ - m_private->m_resourceRequest->setRequestorID(requestorID); -} - -int WebURLRequest::requestorProcessID() const -{ - return m_private->m_resourceRequest->requestorProcessID(); -} - -void WebURLRequest::setRequestorProcessID(int requestorProcessID) -{ - m_private->m_resourceRequest->setRequestorProcessID(requestorProcessID); -} - -int WebURLRequest::appCacheContextID() const -{ - return m_private->m_resourceRequest->appCacheContextID(); -} - -void WebURLRequest::setAppCacheContextID(int appCacheContextID) -{ - m_private->m_resourceRequest->setAppCacheContextID(appCacheContextID); -} - -WebCString WebURLRequest::securityInfo() const -{ - return m_private->m_resourceRequest->securityInfo(); -} - -void WebURLRequest::setSecurityInfo(const WebCString& securityInfo) -{ - m_private->m_resourceRequest->setSecurityInfo(securityInfo); -} - -ResourceRequest& WebURLRequest::toMutableResourceRequest() -{ - ASSERT(m_private); - ASSERT(m_private->m_resourceRequest); - - return *m_private->m_resourceRequest; -} - -const ResourceRequest& WebURLRequest::toResourceRequest() const -{ - ASSERT(m_private); - ASSERT(m_private->m_resourceRequest); - - return *m_private->m_resourceRequest; -} - -void WebURLRequest::assign(WebURLRequestPrivate* p) -{ - if (m_private) - m_private->dispose(); - m_private = p; -} - -} // namespace WebKit diff --git a/webkit/api/src/WebURLRequestPrivate.h b/webkit/api/src/WebURLRequestPrivate.h deleted file mode 100644 index 57ef3d1..0000000 --- a/webkit/api/src/WebURLRequestPrivate.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 WebURLRequestPrivate_h -#define WebURLRequestPrivate_h - -#include "WebHTTPBody.h" - -namespace WebCore { struct ResourceRequest; } - -namespace WebKit { - - class WebURLRequestPrivate { - public: - WebURLRequestPrivate() : m_resourceRequest(0) { } - - // Called by WebURLRequest when it no longer needs this object. - virtual void dispose() = 0; - - WebCore::ResourceRequest* m_resourceRequest; - WebHTTPBody m_httpBody; - }; - -} // namespace WebKit - -#endif diff --git a/webkit/api/src/WebURLResponse.cpp b/webkit/api/src/WebURLResponse.cpp deleted file mode 100644 index 52e193f..0000000 --- a/webkit/api/src/WebURLResponse.cpp +++ /dev/null @@ -1,259 +0,0 @@ -/* - * 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. - */ - -#include "config.h" -#include "WebURLResponse.h" - -#include "WebHTTPHeaderVisitor.h" -#include "WebString.h" -#include "WebURL.h" -#include "WebURLResponsePrivate.h" - -#include "ResourceResponse.h" - -using namespace WebCore; - -namespace WebKit { - -// The standard implementation of WebURLResponsePrivate, which maintains -// ownership of a ResourceResponse instance. -class WebURLResponsePrivateImpl : public WebURLResponsePrivate { -public: - WebURLResponsePrivateImpl() - { - m_resourceResponse = &m_resourceResponseAllocation; - } - - WebURLResponsePrivateImpl(const WebURLResponsePrivate* p) - : m_resourceResponseAllocation(*p->m_resourceResponse) - { - m_resourceResponse = &m_resourceResponseAllocation; - } - - virtual void dispose() { delete this; } - - ResourceResponse m_resourceResponseAllocation; -}; - -void WebURLResponse::initialize() -{ - assign(new WebURLResponsePrivateImpl()); -} - -void WebURLResponse::reset() -{ - assign(0); -} - -void WebURLResponse::assign(const WebURLResponse& r) -{ - assign(r.m_private ? new WebURLResponsePrivateImpl(r.m_private) : 0); -} - -WebURL WebURLResponse::url() const -{ - return m_private->m_resourceResponse->url(); -} - -void WebURLResponse::setURL(const WebURL& url) -{ - m_private->m_resourceResponse->setURL(url); -} - -WebString WebURLResponse::mimeType() const -{ - return m_private->m_resourceResponse->mimeType(); -} - -void WebURLResponse::setMIMEType(const WebString& mimeType) -{ - m_private->m_resourceResponse->setMimeType(mimeType); -} - -long long WebURLResponse::expectedContentLength() const -{ - return m_private->m_resourceResponse->expectedContentLength(); -} - -void WebURLResponse::setExpectedContentLength(long long expectedContentLength) -{ - m_private->m_resourceResponse->setExpectedContentLength(expectedContentLength); -} - -WebString WebURLResponse::textEncodingName() const -{ - return m_private->m_resourceResponse->textEncodingName(); -} - -void WebURLResponse::setTextEncodingName(const WebString& textEncodingName) -{ - m_private->m_resourceResponse->setTextEncodingName(textEncodingName); -} - -WebString WebURLResponse::suggestedFileName() const -{ - return m_private->m_resourceResponse->suggestedFilename(); -} - -void WebURLResponse::setSuggestedFileName(const WebString& suggestedFileName) -{ - m_private->m_resourceResponse->setSuggestedFilename(suggestedFileName); -} - -int WebURLResponse::httpStatusCode() const -{ - return m_private->m_resourceResponse->httpStatusCode(); -} - -void WebURLResponse::setHTTPStatusCode(int httpStatusCode) -{ - m_private->m_resourceResponse->setHTTPStatusCode(httpStatusCode); -} - -WebString WebURLResponse::httpStatusText() const -{ - return m_private->m_resourceResponse->httpStatusText(); -} - -void WebURLResponse::setHTTPStatusText(const WebString& httpStatusText) -{ - m_private->m_resourceResponse->setHTTPStatusText(httpStatusText); -} - -WebString WebURLResponse::httpHeaderField(const WebString& name) const -{ - return m_private->m_resourceResponse->httpHeaderField(String(name)); -} - -void WebURLResponse::setHTTPHeaderField(const WebString& name, const WebString& value) -{ - m_private->m_resourceResponse->setHTTPHeaderField(String(name), value); -} - -void WebURLResponse::addHTTPHeaderField(const WebString& name, const WebString& value) -{ - // FIXME: Add an addHTTPHeaderField method to ResourceResponse. - const HTTPHeaderMap& map = m_private->m_resourceResponse->httpHeaderFields(); - String valueStr(value); - pair<HTTPHeaderMap::iterator, bool> result = - const_cast<HTTPHeaderMap*>(&map)->add(String(name), valueStr); - if (!result.second) - result.first->second += "," + valueStr; -} - -void WebURLResponse::clearHTTPHeaderField(const WebString& name) -{ - // FIXME: Add a clearHTTPHeaderField method to ResourceResponse. - const HTTPHeaderMap& map = m_private->m_resourceResponse->httpHeaderFields(); - const_cast<HTTPHeaderMap*>(&map)->remove(String(name)); -} - -void WebURLResponse::visitHTTPHeaderFields(WebHTTPHeaderVisitor* visitor) const -{ - const HTTPHeaderMap& map = m_private->m_resourceResponse->httpHeaderFields(); - for (HTTPHeaderMap::const_iterator it = map.begin(); it != map.end(); ++it) - visitor->visitHeader(String(it->first), it->second); -} - -double WebURLResponse::expirationDate() const -{ - return static_cast<double>(m_private->m_resourceResponse->expirationDate()); -} - -void WebURLResponse::setExpirationDate(double expirationDate) -{ - m_private->m_resourceResponse->setExpirationDate(static_cast<time_t>(expirationDate)); -} - -double WebURLResponse::lastModifiedDate() const -{ - return static_cast<double>(m_private->m_resourceResponse->lastModifiedDate()); -} - -void WebURLResponse::setLastModifiedDate(double lastModifiedDate) -{ - m_private->m_resourceResponse->setLastModifiedDate(static_cast<time_t>(lastModifiedDate)); -} - -bool WebURLResponse::isContentFiltered() const -{ - return m_private->m_resourceResponse->isContentFiltered(); -} - -void WebURLResponse::setIsContentFiltered(bool isContentFiltered) -{ - m_private->m_resourceResponse->setIsContentFiltered(isContentFiltered); -} - -long long WebURLResponse::appCacheID() const -{ - return m_private->m_resourceResponse->getAppCacheID(); -} - -void WebURLResponse::setAppCacheID(long long appCacheID) -{ - m_private->m_resourceResponse->setAppCacheID(appCacheID); -} - -WebCString WebURLResponse::securityInfo() const -{ - // FIXME: getSecurityInfo is misnamed. - return m_private->m_resourceResponse->getSecurityInfo(); -} - -void WebURLResponse::setSecurityInfo(const WebCString& securityInfo) -{ - m_private->m_resourceResponse->setSecurityInfo(securityInfo); -} - -ResourceResponse& WebURLResponse::toMutableResourceResponse() -{ - ASSERT(m_private); - ASSERT(m_private->m_resourceResponse); - - return *m_private->m_resourceResponse; -} - -const ResourceResponse& WebURLResponse::toResourceResponse() const -{ - ASSERT(m_private); - ASSERT(m_private->m_resourceResponse); - - return *m_private->m_resourceResponse; -} - -void WebURLResponse::assign(WebURLResponsePrivate* p) -{ - if (m_private) - m_private->dispose(); - m_private = p; -} - -} // namespace WebKit diff --git a/webkit/api/src/WebURLResponsePrivate.h b/webkit/api/src/WebURLResponsePrivate.h deleted file mode 100644 index d421c1a..0000000 --- a/webkit/api/src/WebURLResponsePrivate.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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 WebURLResponsePrivate_h -#define WebURLResponsePrivate_h - -namespace WebCore { class ResourceResponse; } - -namespace WebKit { - - class WebURLResponsePrivate { - public: - WebURLResponsePrivate() : m_resourceResponse(0) { } - - // Called by WebURLResponse when it no longer needs this object. - virtual void dispose() = 0; - - WebCore::ResourceResponse* m_resourceResponse; - }; - -} // namespace WebKit - -#endif diff --git a/webkit/api/src/WrappedResourceRequest.h b/webkit/api/src/WrappedResourceRequest.h deleted file mode 100644 index 58188c1..0000000 --- a/webkit/api/src/WrappedResourceRequest.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -#include "WebURLRequestPrivate.h" - -namespace WebKit { - - class WrappedResourceRequest : public WebURLRequest { - public: - ~WrappedResourceRequest() - { - reset(); // Need to drop reference to m_handle - } - - WrappedResourceRequest(WebCore::ResourceRequest& resourceRequest) - { - bind(&resourceRequest); - } - - WrappedResourceRequest(const WebCore::ResourceRequest& resourceRequest) - { - bind(const_cast<WebCore::ResourceRequest*>(&resourceRequest)); - } - - private: - void bind(WebCore::ResourceRequest* resourceRequest) - { - m_handle.m_resourceRequest = resourceRequest; - assign(&m_handle); - } - - class Handle : public WebURLRequestPrivate { - public: - virtual void dispose() { m_resourceRequest = 0; } - }; - - Handle m_handle; - }; - -} // namespace WebKit diff --git a/webkit/api/src/WrappedResourceResponse.h b/webkit/api/src/WrappedResourceResponse.h deleted file mode 100644 index fe7bb99..0000000 --- a/webkit/api/src/WrappedResourceResponse.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "WebURLResponse.h" -#include "WebURLResponsePrivate.h" - -namespace WebKit { - - class WrappedResourceResponse : public WebURLResponse { - public: - ~WrappedResourceResponse() - { - reset(); // Need to drop reference to m_handle - } - - WrappedResourceResponse(WebCore::ResourceResponse& resourceResponse) - { - bind(&resourceResponse); - } - - WrappedResourceResponse(const WebCore::ResourceResponse& resourceResponse) - { - bind(const_cast<WebCore::ResourceResponse*>(&resourceResponse)); - } - - private: - void bind(WebCore::ResourceResponse* resourceResponse) - { - m_handle.m_resourceResponse = resourceResponse; - assign(&m_handle); - } - - class Handle : public WebURLResponsePrivate { - public: - virtual void dispose() { m_resourceResponse = 0; } - }; - - Handle m_handle; - }; - -} // namespace WebKit |