summaryrefslogtreecommitdiffstats
path: root/chrome/browser/icon_loader.h
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-08 19:01:02 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-08 19:01:02 +0000
commit0f38ceaebbc66b29fb3297516f74f9c8379d902f (patch)
tree8af215d4a01c60a2d3a5fe0aa55fd35cab05a744 /chrome/browser/icon_loader.h
parenteac83f0d14be2fed85edf2ffad934dd1309819e7 (diff)
downloadchromium_src-0f38ceaebbc66b29fb3297516f74f9c8379d902f.zip
chromium_src-0f38ceaebbc66b29fb3297516f74f9c8379d902f.tar.gz
chromium_src-0f38ceaebbc66b29fb3297516f74f9c8379d902f.tar.bz2
Stub implementation of linux, mac icon loader/manager.
Define a platform specific type IconGroupID which helps with caching multiple requests for the same icon. Previously we just used the file path (or the extension), but on POSIX we use mime types rather than extensions. Review URL: http://codereview.chromium.org/113120 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15665 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/icon_loader.h')
-rw-r--r--chrome/browser/icon_loader.h35
1 files changed, 28 insertions, 7 deletions
diff --git a/chrome/browser/icon_loader.h b/chrome/browser/icon_loader.h
index a02c6ba..b7e76ba 100644
--- a/chrome/browser/icon_loader.h
+++ b/chrome/browser/icon_loader.h
@@ -11,6 +11,16 @@
#include "base/file_path.h"
#include "base/ref_counted.h"
+#if defined(OS_WIN)
+// On Windows, we group files by their extension, with several exceptions:
+// .dll, .exe, .ico. See IconManager.h for explanation.
+typedef std::wstring IconGroupID;
+#elif defined(OS_POSIX)
+// On POSIX, we group files by MIME type.
+typedef std::string IconGroupID;
+#endif
+
+class MessageLoop;
class SkBitmap;
////////////////////////////////////////////////////////////////////////////////
@@ -35,18 +45,29 @@ class IconLoader : public base::RefCountedThreadSafe<IconLoader> {
virtual bool OnBitmapLoaded(IconLoader* source, SkBitmap* result) = 0;
};
- IconLoader() { }
+ IconLoader(const IconGroupID& group, IconSize size, Delegate* delegate);
- virtual ~IconLoader() { }
+ virtual ~IconLoader();
// Start reading the icon on the file thread.
- virtual void Start() = 0;
-
- // Factory method for returning a platform specific IconLoad.
- static IconLoader* Create(const FilePath& path, IconSize size,
- Delegate* delegate);
+ void Start();
private:
+ void ReadIcon();
+
+ void NotifyDelegate();
+
+ // The message loop object of the thread in which we notify the delegate.
+ MessageLoop* target_message_loop_;
+
+ IconGroupID group_;
+
+ IconSize icon_size_;
+
+ SkBitmap* bitmap_;
+
+ Delegate* delegate_;
+
DISALLOW_COPY_AND_ASSIGN(IconLoader);
};