summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/download_item_mac.h
diff options
context:
space:
mode:
authorpaul@chromium.org <paul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-22 19:20:45 +0000
committerpaul@chromium.org <paul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-22 19:20:45 +0000
commit25ebbf4a2894b6b60350cf22740a0ba7ad9ee7c3 (patch)
tree49ff36ea57d4603ac6b77156150c942af162c6df /chrome/browser/cocoa/download_item_mac.h
parent95fe32f45f41ffd496466bc938968cabae2bad59 (diff)
downloadchromium_src-25ebbf4a2894b6b60350cf22740a0ba7ad9ee7c3.zip
chromium_src-25ebbf4a2894b6b60350cf22740a0ba7ad9ee7c3.tar.gz
chromium_src-25ebbf4a2894b6b60350cf22740a0ba7ad9ee7c3.tar.bz2
Load Mac download shelf icons asynchronously.
BUG=16226 (http://crbug.com/16226) TEST=none. Review URL: http://codereview.chromium.org/155831 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21305 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/download_item_mac.h')
-rw-r--r--chrome/browser/cocoa/download_item_mac.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/chrome/browser/cocoa/download_item_mac.h b/chrome/browser/cocoa/download_item_mac.h
index 7f31c2a..f992e21 100644
--- a/chrome/browser/cocoa/download_item_mac.h
+++ b/chrome/browser/cocoa/download_item_mac.h
@@ -9,13 +9,16 @@
#include "base/scoped_nsobject.h"
#include "base/scoped_ptr.h"
+#include "chrome/browser/cancelable_request.h"
#include "chrome/browser/download/download_manager.h"
+#include "chrome/browser/icon_manager.h"
class BaseDownloadItemModel;
@class DownloadItemController;
-// A class that bridges the visible mac download items to chromium's
-// download model.
+// A class that bridges the visible mac download items to chromium's download
+// model. The owning object (DownloadItemController) must explicitly call
+// |LoadIcon| if it wants to display the icon associated with this download.
class DownloadItemMac : DownloadItem::Observer {
public:
@@ -32,12 +35,23 @@ class DownloadItemMac : DownloadItem::Observer {
BaseDownloadItemModel* download_model() { return download_model_.get(); }
+ // Asynchronous icon loading support.
+ void LoadIcon();
+
private:
+ // Callback for asynchronous icon loading.
+ void OnExtractIconComplete(IconManager::Handle handle, SkBitmap* icon_bitmap);
+
// The download item model we represent.
scoped_ptr<BaseDownloadItemModel> download_model_;
// The objective-c controller object.
DownloadItemController* item_controller_; // weak, owns us.
+
+ // For canceling an in progress icon request.
+ CancelableRequestConsumerT<int, 0> icon_consumer_;
+
+ DISALLOW_COPY_AND_ASSIGN(DownloadItemMac);
};
#endif // CHROME_BROWSER_COCOA_DOWNLOAD_ITEM_MAC_H_