diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-09 18:45:04 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-09 18:45:04 +0000 |
commit | f92eb0034a4b0a8249f739df38b82add5e36044f (patch) | |
tree | d7749b8bf473f61d86a50ce04736950d1862c574 /webkit/api/public/WebURLRequest.h | |
parent | b72eb73e72040cdaaa8957ca7a7417f9b89843fe (diff) | |
download | chromium_src-f92eb0034a4b0a8249f739df38b82add5e36044f.zip chromium_src-f92eb0034a4b0a8249f739df38b82add5e36044f.tar.gz chromium_src-f92eb0034a4b0a8249f739df38b82add5e36044f.tar.bz2 |
Start using WebURLLoader, et. al. from the WebKit API.
Moves our ResourceHandle to webkit/api/src/ResourceHandle.cpp
from webkit/glue/resource_handle_impl.cc. A portion of
resource_handle_impl.cc was moved into weburlloader_impl.{h,cc},
which now contains our implementation of WebURLLoader.
The annoying parts of this CL involve WebPluginImpl. I had to
convert it over to using WebURLLoader instead of ResourceHandle
so that MultipartResourceDelegate can be shared.
There is some complexity in WebURLRequest / WebURLResponse to
make it cheap to wrap a ResourceRequest / ResourceResponse. I
think this is worth it since there is a lot of conversion between
the two types.
Originally reviewed here:
http://codereview.chromium.org/113928
BUG=10038
TEST=covered by existing tests
R=dglazkov
Review URL: http://codereview.chromium.org/118438
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17962 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/api/public/WebURLRequest.h')
-rw-r--r-- | webkit/api/public/WebURLRequest.h | 84 |
1 files changed, 52 insertions, 32 deletions
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; |