2
Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3
Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
4
Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
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.
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.
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., 59 Temple Place - Suite 330,
19
Boston, MA 02111-1307, USA.
21
This class provides all functionality needed for loading images, style sheets and html
22
pages from the web. It has a memory cache for these objects.
28
#include "CachedResource.h"
29
#include "CachePolicy.h"
30
#include "StringHash.h"
31
#include <wtf/HashMap.h>
32
#include <wtf/HashSet.h>
36
class CachedCSSStyleSheet;
39
class CachedXSLStyleSheet;
42
class HTMLImageLoader;
45
// The DocLoader manages the loading of scripts/images/stylesheets for a single document.
49
friend class HTMLImageLoader;
52
DocLoader(Frame*, Document*);
55
CachedImage* requestImage(const String& url);
56
CachedCSSStyleSheet* requestCSSStyleSheet(const String& url, const String& charset, bool isUserStyleSheet = false);
57
CachedCSSStyleSheet* requestUserCSSStyleSheet(const String& url, const String& charset);
58
CachedScript* requestScript(const String& url, const String& charset);
61
CachedXSLStyleSheet* requestXSLStyleSheet(const String& url);
64
CachedXBLDocument* requestXBLDocument(const String &url);
67
CachedResource* cachedResource(const String& url) const { return m_docResources.get(url); }
68
const HashMap<String, CachedResource*>& allCachedResources() const { return m_docResources; }
70
bool autoLoadImages() const { return m_autoLoadImages; }
71
void setAutoLoadImages(bool);
73
CachePolicy cachePolicy() const { return m_cachePolicy; }
74
void setCachePolicy(CachePolicy);
76
Frame* frame() const { return m_frame; }
77
Document* doc() const { return m_doc; }
79
void removeCachedResource(CachedResource*) const;
81
void setLoadInProgress(bool);
82
bool loadInProgress() const { return m_loadInProgress; }
84
void setAllowStaleResources(bool allowStaleResources) { m_allowStaleResources = allowStaleResources; }
86
#if USE(LOW_BANDWIDTH_DISPLAY)
87
void replaceDocument(Document* doc) { m_doc = doc; }
90
void incrementRequestCount();
91
void decrementRequestCount();
94
CachedResource* requestResource(CachedResource::Type, const String& url, const String* charset = 0, bool skipCanLoadCheck = false, bool sendResourceLoadCallbacks = true);
96
void checkForReload(const KURL&);
97
void checkCacheObjectStatus(CachedResource*);
100
HashSet<String> m_reloadedURLs;
101
mutable HashMap<String, CachedResource*> m_docResources;
102
CachePolicy m_cachePolicy;
109
bool m_autoLoadImages : 1;
110
bool m_loadInProgress : 1;
111
bool m_allowStaleResources : 1;