1643ca7872b450ea4efacab6188849e5aac2ba161Steve Block/*
2643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * Copyright (C) 2009 Google Inc. All rights reserved.
3643ca7872b450ea4efacab6188849e5aac2ba161Steve Block *
4643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * Redistribution and use in source and binary forms, with or without
5643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * modification, are permitted provided that the following conditions are
6643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * met:
7643ca7872b450ea4efacab6188849e5aac2ba161Steve Block *
8643ca7872b450ea4efacab6188849e5aac2ba161Steve Block *     * Redistributions of source code must retain the above copyright
9643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * notice, this list of conditions and the following disclaimer.
10643ca7872b450ea4efacab6188849e5aac2ba161Steve Block *     * Redistributions in binary form must reproduce the above
11643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * copyright notice, this list of conditions and the following disclaimer
12643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * in the documentation and/or other materials provided with the
13643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * distribution.
14643ca7872b450ea4efacab6188849e5aac2ba161Steve Block *     * Neither the name of Google Inc. nor the names of its
15643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * contributors may be used to endorse or promote products derived from
16643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * this software without specific prior written permission.
17643ca7872b450ea4efacab6188849e5aac2ba161Steve Block *
18643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29643ca7872b450ea4efacab6188849e5aac2ba161Steve Block */
30643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
31643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#include "config.h"
32643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#include "WebURLRequest.h"
33643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
34643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#include "ResourceRequest.h"
35643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
36643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#include "WebHTTPBody.h"
37643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#include "WebHTTPHeaderVisitor.h"
38643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#include "WebURL.h"
39643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#include "WebURLRequestPrivate.h"
40643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
41643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockusing namespace WebCore;
42643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
43643ca7872b450ea4efacab6188849e5aac2ba161Steve Blocknamespace WebKit {
44643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
45643ca7872b450ea4efacab6188849e5aac2ba161Steve Block// The standard implementation of WebURLRequestPrivate, which maintains
46643ca7872b450ea4efacab6188849e5aac2ba161Steve Block// ownership of a ResourceRequest instance.
47643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockclass WebURLRequestPrivateImpl : public WebURLRequestPrivate {
48643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockpublic:
49643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    WebURLRequestPrivateImpl()
50643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    {
51643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        m_resourceRequest = &m_resourceRequestAllocation;
52643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    }
53643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
54643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    WebURLRequestPrivateImpl(const WebURLRequestPrivate* p)
55643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        : m_resourceRequestAllocation(*p->m_resourceRequest)
56643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    {
57643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        m_resourceRequest = &m_resourceRequestAllocation;
58643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    }
59643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
60643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    virtual void dispose() { delete this; }
61643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
62643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    ResourceRequest m_resourceRequestAllocation;
63643ca7872b450ea4efacab6188849e5aac2ba161Steve Block};
64643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
65643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockvoid WebURLRequest::initialize()
66643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
67643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    assign(new WebURLRequestPrivateImpl());
68643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
69643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
70643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockvoid WebURLRequest::reset()
71643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
72643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    assign(0);
73643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
74643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
75643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockvoid WebURLRequest::assign(const WebURLRequest& r)
76643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
77643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    if (&r != this)
78643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        assign(r.m_private ? new WebURLRequestPrivateImpl(r.m_private) : 0);
79643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
80643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
81643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockbool WebURLRequest::isNull() const
82643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
83643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return !m_private || m_private->m_resourceRequest->isNull();
84643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
85643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
86643ca7872b450ea4efacab6188849e5aac2ba161Steve BlockWebURL WebURLRequest::url() const
87643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
88643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return m_private->m_resourceRequest->url();
89643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
90643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
91643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockvoid WebURLRequest::setURL(const WebURL& url)
92643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
93643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    m_private->m_resourceRequest->setURL(url);
94643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
95643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
96643ca7872b450ea4efacab6188849e5aac2ba161Steve BlockWebURL WebURLRequest::firstPartyForCookies() const
97643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
98643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return m_private->m_resourceRequest->firstPartyForCookies();
99643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
100643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
101643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockvoid WebURLRequest::setFirstPartyForCookies(const WebURL& firstPartyForCookies)
102643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
103643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    m_private->m_resourceRequest->setFirstPartyForCookies(firstPartyForCookies);
104643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
105643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
106643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockbool WebURLRequest::allowCookies() const
107643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
108643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return m_private->m_resourceRequest->allowCookies();
109643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
110643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
111643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockvoid WebURLRequest::setAllowCookies(bool allowCookies)
112643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
113643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    m_private->m_resourceRequest->setAllowCookies(allowCookies);
114643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
115643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
116643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockbool WebURLRequest::allowStoredCredentials() const
117643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
118643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return m_private->m_allowStoredCredentials;
119643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
120643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
121643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockvoid WebURLRequest::setAllowStoredCredentials(bool allowStoredCredentials)
122643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
123643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    m_private->m_allowStoredCredentials = allowStoredCredentials;
124643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
125643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
126643ca7872b450ea4efacab6188849e5aac2ba161Steve BlockWebURLRequest::CachePolicy WebURLRequest::cachePolicy() const
127643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
128643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return static_cast<WebURLRequest::CachePolicy>(
129643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        m_private->m_resourceRequest->cachePolicy());
130643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
131643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
132643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockvoid WebURLRequest::setCachePolicy(CachePolicy cachePolicy)
133643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
134643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    m_private->m_resourceRequest->setCachePolicy(
135643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        static_cast<ResourceRequestCachePolicy>(cachePolicy));
136643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
137643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
138643ca7872b450ea4efacab6188849e5aac2ba161Steve BlockWebString WebURLRequest::httpMethod() const
139643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
140643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return m_private->m_resourceRequest->httpMethod();
141643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
142643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
143643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockvoid WebURLRequest::setHTTPMethod(const WebString& httpMethod)
144643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
145643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    m_private->m_resourceRequest->setHTTPMethod(httpMethod);
146643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
147643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
148643ca7872b450ea4efacab6188849e5aac2ba161Steve BlockWebString WebURLRequest::httpHeaderField(const WebString& name) const
149643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
150643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return m_private->m_resourceRequest->httpHeaderField(name);
151643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
152643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
153643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockvoid WebURLRequest::setHTTPHeaderField(const WebString& name, const WebString& value)
154643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
155643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    m_private->m_resourceRequest->setHTTPHeaderField(name, value);
156643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
157643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
158643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockvoid WebURLRequest::addHTTPHeaderField(const WebString& name, const WebString& value)
159643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
160643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    m_private->m_resourceRequest->addHTTPHeaderField(name, value);
161643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
162643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
163643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockvoid WebURLRequest::clearHTTPHeaderField(const WebString& name)
164643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
165643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    // FIXME: Add a clearHTTPHeaderField method to ResourceRequest.
166643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    const HTTPHeaderMap& map = m_private->m_resourceRequest->httpHeaderFields();
167643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    const_cast<HTTPHeaderMap*>(&map)->remove(name);
168643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
169643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
170643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockvoid WebURLRequest::visitHTTPHeaderFields(WebHTTPHeaderVisitor* visitor) const
171643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
172643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    const HTTPHeaderMap& map = m_private->m_resourceRequest->httpHeaderFields();
173643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    for (HTTPHeaderMap::const_iterator it = map.begin(); it != map.end(); ++it)
174643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        visitor->visitHeader(it->first, it->second);
175643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
176643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
177643ca7872b450ea4efacab6188849e5aac2ba161Steve BlockWebHTTPBody WebURLRequest::httpBody() const
178643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
179643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return WebHTTPBody(m_private->m_resourceRequest->httpBody());
180643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
181643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
182643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockvoid WebURLRequest::setHTTPBody(const WebHTTPBody& httpBody)
183643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
184643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    m_private->m_resourceRequest->setHTTPBody(httpBody);
185643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
186643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
187643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockbool WebURLRequest::reportUploadProgress() const
188643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
189643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return m_private->m_resourceRequest->reportUploadProgress();
190643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
191643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
192643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockvoid WebURLRequest::setReportUploadProgress(bool reportUploadProgress)
193643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
194643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    m_private->m_resourceRequest->setReportUploadProgress(reportUploadProgress);
195643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
196643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
197643ca7872b450ea4efacab6188849e5aac2ba161Steve BlockWebURLRequest::TargetType WebURLRequest::targetType() const
198643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
199643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return static_cast<TargetType>(m_private->m_resourceRequest->targetType());
200643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
201643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
202643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockvoid WebURLRequest::setTargetType(TargetType targetType)
203643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
204643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    m_private->m_resourceRequest->setTargetType(
205643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        static_cast<ResourceRequest::TargetType>(targetType));
206643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
207643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
208643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockint WebURLRequest::requestorID() const
209643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
210643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return m_private->m_resourceRequest->requestorID();
211643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
212643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
213643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockvoid WebURLRequest::setRequestorID(int requestorID)
214643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
215643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    m_private->m_resourceRequest->setRequestorID(requestorID);
216643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
217643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
218643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockint WebURLRequest::requestorProcessID() const
219643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
220643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return m_private->m_resourceRequest->requestorProcessID();
221643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
222643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
223643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockvoid WebURLRequest::setRequestorProcessID(int requestorProcessID)
224643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
225643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    m_private->m_resourceRequest->setRequestorProcessID(requestorProcessID);
226643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
227643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
228643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockint WebURLRequest::appCacheHostID() const
229643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
230643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return m_private->m_resourceRequest->appCacheHostID();
231643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
232643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
233643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockvoid WebURLRequest::setAppCacheHostID(int appCacheHostID)
234643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
235643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    m_private->m_resourceRequest->setAppCacheHostID(appCacheHostID);
236643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
237643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
238643ca7872b450ea4efacab6188849e5aac2ba161Steve BlockResourceRequest& WebURLRequest::toMutableResourceRequest()
239643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
240643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    ASSERT(m_private);
241643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    ASSERT(m_private->m_resourceRequest);
242643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
243643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return *m_private->m_resourceRequest;
244643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
245643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
246643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockconst ResourceRequest& WebURLRequest::toResourceRequest() const
247643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
248643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    ASSERT(m_private);
249643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    ASSERT(m_private->m_resourceRequest);
250643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
251643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    return *m_private->m_resourceRequest;
252643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
253643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
254643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockvoid WebURLRequest::assign(WebURLRequestPrivate* p)
255643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{
256643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    // Subclasses may call this directly so a self-assignment check is needed
257643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    // here as well as in the public assign method.
258643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    if (m_private == p)
259643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        return;
260643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    if (m_private)
261643ca7872b450ea4efacab6188849e5aac2ba161Steve Block        m_private->dispose();
262643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    m_private = p;
263643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}
264643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
265643ca7872b450ea4efacab6188849e5aac2ba161Steve Block} // namespace WebKit
266