| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 */ | |
| 30 | |
| 31 #ifndef WebURLRequest_h | |
| 32 #define WebURLRequest_h | |
| 33 | |
| 34 #include "WebCommon.h" | |
| 35 #include "WebHTTPBody.h" | |
| 36 | |
| 37 #if defined(WEBKIT_IMPLEMENTATION) | |
| 38 namespace WebCore { class ResourceRequest; } | |
| 39 #endif | |
| 40 | |
| 41 namespace WebKit { | |
| 42 | |
| 43 class WebCString; | |
| 44 class WebHTTPBody; | |
| 45 class WebHTTPHeaderVisitor; | |
| 46 class WebString; | |
| 47 class WebURL; | |
| 48 class WebURLRequestPrivate; | |
| 49 | |
| 50 class WebURLRequest { | |
| 51 public: | |
| 52 enum CachePolicy { | |
| 53 UseProtocolCachePolicy, // normal load | |
| 54 ReloadIgnoringCacheData, // reload | |
| 55 ReturnCacheDataElseLoad, // back/forward or encoding change - allow stale data | |
| 56 ReturnCacheDataDontLoad, // results of a post - allow stale data and only use cache | |
| 57 }; | |
| 58 | |
| 59 enum TargetType { | |
| 60 TargetIsMainFrame, | |
| 61 TargetIsSubFrame, | |
| 62 TargetIsSubResource, | |
| 63 TargetIsObject, | |
| 64 TargetIsMedia | |
| 65 }; | |
| 66 | |
| 67 ~WebURLRequest() { reset(); } | |
| 68 | |
| 69 WebURLRequest() : m_private(0) { } | |
| 70 WebURLRequest(const WebURLRequest& r) : m_private(0) { assign(r); } | |
| 71 WebURLRequest& operator=(const WebURLRequest& r) | |
| 72 { | |
| 73 assign(r); | |
| 74 return *this; | |
| 75 } | |
| 76 | |
| 77 explicit WebURLRequest(const WebURL& url) : m_private(0) | |
| 78 { | |
| 79 initialize(); | |
| 80 setURL(url); | |
| 81 } | |
| 82 | |
| 83 WEBKIT_API void initialize(); | |
| 84 WEBKIT_API void reset(); | |
| 85 WEBKIT_API void assign(const WebURLRequest&); | |
| 86 | |
| 87 WEBKIT_API bool isNull() const; | |
| 88 | |
| 89 WEBKIT_API WebURL url() const; | |
| 90 WEBKIT_API void setURL(const WebURL&); | |
| 91 | |
| 92 // Used to implement third-party cookie blocking. | |
| 93 WEBKIT_API WebURL firstPartyForCookies() const; | |
| 94 WEBKIT_API void setFirstPartyForCookies(const WebURL&); | |
| 95 | |
| 96 WEBKIT_API bool allowCookies() const; | |
| 97 WEBKIT_API void setAllowCookies(bool allowCookies); | |
| 98 | |
| 99 // Controls whether user name, password, and cookies may be sent with the | |
| 100 // request. (If false, this overrides allowCookies.) | |
| 101 WEBKIT_API bool allowStoredCredentials() const; | |
| 102 WEBKIT_API void setAllowStoredCredentials(bool allowStoredCredentials); | |
| 103 | |
| 104 WEBKIT_API CachePolicy cachePolicy() const; | |
| 105 WEBKIT_API void setCachePolicy(CachePolicy); | |
| 106 | |
| 107 WEBKIT_API WebString httpMethod() const; | |
| 108 WEBKIT_API void setHTTPMethod(const WebString&); | |
| 109 | |
| 110 WEBKIT_API WebString httpHeaderField(const WebString& name) const; | |
| 111 WEBKIT_API void setHTTPHeaderField(const WebString& name, const WebString& value); | |
| 112 WEBKIT_API void addHTTPHeaderField(const WebString& name, const WebString& value); | |
| 113 WEBKIT_API void clearHTTPHeaderField(const WebString& name); | |
| 114 WEBKIT_API void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) const; | |
| 115 | |
| 116 WEBKIT_API WebHTTPBody httpBody() const; | |
| 117 WEBKIT_API void setHTTPBody(const WebHTTPBody&); | |
| 118 | |
| 119 // Controls whether upload progress events are generated when a request | |
| 120 // has a body. | |
| 121 WEBKIT_API bool reportUploadProgress() const; | |
| 122 WEBKIT_API void setReportUploadProgress(bool); | |
| 123 | |
| 124 WEBKIT_API TargetType targetType() const; | |
| 125 WEBKIT_API void setTargetType(TargetType); | |
| 126 | |
| 127 // A consumer controlled value intended to be used to identify the | |
| 128 // requestor. | |
| 129 WEBKIT_API int requestorID() const; | |
| 130 WEBKIT_API void setRequestorID(int); | |
| 131 | |
| 132 // A consumer controlled value intended to be used to identify the | |
| 133 // process of the requestor. | |
| 134 WEBKIT_API int requestorProcessID() const; | |
| 135 WEBKIT_API void setRequestorProcessID(int); | |
| 136 | |
| 137 // Allows the request to be matched up with its app cache host. | |
| 138 WEBKIT_API int appCacheHostID() const; | |
| 139 WEBKIT_API void setAppCacheHostID(int id); | |
| 140 | |
| 141 #if defined(WEBKIT_IMPLEMENTATION) | |
| 142 WebCore::ResourceRequest& toMutableResourceRequest(); | |
| 143 const WebCore::ResourceRequest& toResourceRequest() const; | |
| 144 #endif | |
| 145 | |
| 146 protected: | |
| 147 void assign(WebURLRequestPrivate*); | |
| 148 | |
| 149 private: | |
| 150 WebURLRequestPrivate* m_private; | |
| 151 }; | |
| 152 | |
| 153 } // namespace WebKit | |
| 154 | |
| 155 #endif | |
| OLD | NEW |