Home | History | Annotate | Download | only in cache
      1 /*
      2     Copyright (C) 1998 Lars Knoll (knoll (at) mpi-hd.mpg.de)
      3     Copyright (C) 2001 Dirk Mueller <mueller (at) kde.org>
      4     Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.
      5 
      6     This library is free software; you can redistribute it and/or
      7     modify it under the terms of the GNU Library General Public
      8     License as published by the Free Software Foundation; either
      9     version 2 of the License, or (at your option) any later version.
     10 
     11     This library is distributed in the hope that it will be useful,
     12     but WITHOUT ANY WARRANTY; without even the implied warranty of
     13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14     Library General Public License for more details.
     15 
     16     You should have received a copy of the GNU Library General Public License
     17     along with this library; see the file COPYING.LIB.  If not, write to
     18     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     19     Boston, MA 02110-1301, USA.
     20 */
     21 
     22 #ifndef CachedResourceRequest_h
     23 #define CachedResourceRequest_h
     24 
     25 #include "FrameLoaderTypes.h"
     26 #include "SubresourceLoader.h"
     27 #include "SubresourceLoaderClient.h"
     28 #include <wtf/HashMap.h>
     29 #include <wtf/Noncopyable.h>
     30 #include <wtf/RefPtr.h>
     31 
     32 namespace WebCore {
     33 
     34     class CachedResource;
     35     class CachedResourceLoader;
     36     class Request;
     37 
     38     class CachedResourceRequest : public RefCounted<CachedResourceRequest>, private SubresourceLoaderClient {
     39     public:
     40         static PassRefPtr<CachedResourceRequest> load(CachedResourceLoader*, CachedResource*, bool incremental, SecurityCheckPolicy, bool sendResourceLoadCallbacks);
     41         ~CachedResourceRequest();
     42         void didFail(bool cancelled = false);
     43 
     44         CachedResourceLoader* cachedResourceLoader() const { return m_cachedResourceLoader; }
     45 
     46     private:
     47         CachedResourceRequest(CachedResourceLoader*, CachedResource*, bool incremental);
     48         virtual void willSendRequest(SubresourceLoader*, ResourceRequest&, const ResourceResponse&);
     49         virtual void didReceiveResponse(SubresourceLoader*, const ResourceResponse&);
     50         virtual void didReceiveData(SubresourceLoader*, const char*, int);
     51         virtual void didReceiveCachedMetadata(SubresourceLoader*, const char*, int);
     52         virtual void didFinishLoading(SubresourceLoader*, double);
     53         virtual void didFail(SubresourceLoader*, const ResourceError&);
     54 
     55         RefPtr<SubresourceLoader> m_loader;
     56         CachedResourceLoader* m_cachedResourceLoader;
     57         CachedResource* m_resource;
     58         bool m_incremental;
     59         bool m_multipart;
     60         bool m_finishing;
     61     };
     62 
     63 }
     64 
     65 #endif
     66