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
diff --git a/chrome/browser/icon_loader.h b/chrome/browser/icon_loader.h
index a02c6bae..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 @@
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);
};