2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004 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., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
26 #include "AtomicString.h"
27 #include "CachedResourceClient.h"
28 #include "CachedResourceHandle.h"
34 class ImageLoader
: public CachedResourceClient
{
36 ImageLoader(Element
*);
37 virtual ~ImageLoader();
39 void updateFromElement();
41 // This method should be called after the 'src' attribute
42 // is set (even when it is not modified) to force the update
43 // and match Firefox and Opera.
44 void updateFromElementIgnoringPreviousError();
46 virtual void dispatchLoadEvent() = 0;
47 virtual String
sourceURI(const AtomicString
&) const = 0;
49 Element
* element() const { return m_element
; }
50 bool imageComplete() const { return m_imageComplete
; }
52 CachedImage
* image() const { return m_image
.get(); }
53 void setImage(CachedImage
*);
55 void setLoadManually(bool loadManually
) { m_loadManually
= loadManually
; }
57 // CachedResourceClient API
58 virtual void notifyFinished(CachedResource
*);
60 virtual bool memoryLimitReached();
62 bool haveFiredLoadEvent() const { return m_firedLoad
; }
64 void setLoadingImage(CachedImage
*);
66 void setHaveFiredLoadEvent(bool firedLoad
) { m_firedLoad
= firedLoad
; }
70 CachedResourceHandle
<CachedImage
> m_image
;
71 AtomicString m_failedLoadURL
;
73 bool m_imageComplete
: 1;
74 bool m_loadManually
: 1;