2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
26 #include "core/fetch/Resource.h"
27 #include "core/fetch/ResourceClient.h"
30 class RawResourceCallback;
31 class RawResourceClient;
33 class RawResource : public Resource {
35 RawResource(const ResourceRequest&, Type);
37 // FIXME: AssociatedURLLoader shouldn't be a DocumentThreadableLoader and therefore shouldn't
38 // use RawResource. However, it is, and it needs to be able to defer loading.
39 // This can be fixed by splitting CORS preflighting out of DocumentThreacableLoader.
40 virtual void setDefersLoading(bool);
42 virtual void setDataBufferingPolicy(DataBufferingPolicy);
46 virtual bool canReuse(const ResourceRequest&) const;
49 virtual void didAddClient(ResourceClient*);
50 virtual void appendData(const char*, int) OVERRIDE;
52 virtual bool shouldIgnoreHTTPStatusCodeErrors() const { return true; }
54 virtual void willSendRequest(ResourceRequest&, const ResourceResponse&);
55 virtual void responseReceived(const ResourceResponse&);
56 virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent);
57 virtual void didDownloadData(int);
61 explicit RedirectPair(const ResourceRequest& request, const ResourceResponse& redirectResponse)
63 , m_redirectResponse(redirectResponse)
67 const ResourceRequest m_request;
68 const ResourceResponse m_redirectResponse;
71 Vector<RedirectPair> m_redirectChain;
75 class RawResourceClient : public ResourceClient {
77 virtual ~RawResourceClient() { }
78 static ResourceClientType expectedType() { return RawResourceType; }
79 virtual ResourceClientType resourceClientType() const { return expectedType(); }
81 virtual void dataSent(Resource*, unsigned long long /* bytesSent */, unsigned long long /* totalBytesToBeSent */) { }
82 virtual void responseReceived(Resource*, const ResourceResponse&) { }
83 virtual void dataReceived(Resource*, const char* /* data */, int /* length */) { }
84 virtual void redirectReceived(Resource*, ResourceRequest&, const ResourceResponse&) { }
85 virtual void dataDownloaded(Resource*, int) { }
90 #endif // RawResource_h