]> git.saurik.com Git - iphone-api.git/blame - WebCore/ImageLoader.h
Add support for new WinterBoard Settings features.
[iphone-api.git] / WebCore / ImageLoader.h
CommitLineData
a90939db
JF
1/*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004 Apple Computer, Inc.
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
23#ifndef ImageLoader_h
24#define ImageLoader_h
25
26#include "AtomicString.h"
27#include "CachedResourceClient.h"
28#include "CachedResourceHandle.h"
29
30namespace WebCore {
31
32class Element;
33
34class ImageLoader : public CachedResourceClient {
35public:
36 ImageLoader(Element*);
37 virtual ~ImageLoader();
38
39 void updateFromElement();
40
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();
45
46 virtual void dispatchLoadEvent() = 0;
47 virtual String sourceURI(const AtomicString&) const = 0;
48
49 Element* element() const { return m_element; }
50 bool imageComplete() const { return m_imageComplete; }
51
52 CachedImage* image() const { return m_image.get(); }
53 void setImage(CachedImage*);
54
55 void setLoadManually(bool loadManually) { m_loadManually = loadManually; }
56
57 // CachedResourceClient API
58 virtual void notifyFinished(CachedResource*);
59
60 virtual bool memoryLimitReached();
61
62 bool haveFiredLoadEvent() const { return m_firedLoad; }
63protected:
64 void setLoadingImage(CachedImage*);
65
66 void setHaveFiredLoadEvent(bool firedLoad) { m_firedLoad = firedLoad; }
67
68private:
69 Element* m_element;
70 CachedResourceHandle<CachedImage> m_image;
71 AtomicString m_failedLoadURL;
72 bool m_firedLoad : 1;
73 bool m_imageComplete : 1;
74 bool m_loadManually : 1;
75};
76
77}
78
79#endif