Index: trunk/src/chrome/browser/ui/webui/extensions/extension_icon_source.h |
=================================================================== |
--- trunk/src/chrome/browser/ui/webui/extensions/extension_icon_source.h (revision 227519) |
+++ trunk/src/chrome/browser/ui/webui/extensions/extension_icon_source.h (working copy) |
@@ -84,15 +84,45 @@ |
virtual ~ExtensionIconSource(); |
- // Loads the extension's icon for the given |request_id| and returns the |
+ // Returns the bitmap for the default app image. |
+ const SkBitmap* GetDefaultAppImage(); |
+ |
+ // Returns the bitmap for the default extension. |
+ const SkBitmap* GetDefaultExtensionImage(); |
+ |
+ // Performs any remaining transformations (like desaturating the |image|), |
+ // then returns the |image| to the client and clears up any temporary data |
+ // associated with the |request_id|. |
+ void FinalizeImage(const SkBitmap* image, int request_id); |
+ |
+ // Loads the default image for |request_id| and returns to the client. |
+ void LoadDefaultImage(int request_id); |
+ |
+ // Loads the extension's |icon| for the given |request_id| and returns the |
// image to the client. |
- void LoadExtensionImage(int request_id); |
+ void LoadExtensionImage(const ExtensionResource& icon, |
+ int request_id); |
- // LoadExtensionImage() will load the icon using |
- // ImageLoader::LoadExtensionIconAsync(). OnIconLoaded will be called when |
- // the icon has been loaded. |
- void OnIconLoaded(int request_id, const gfx::Image& image); |
+ // Loads the favicon image for the app associated with the |request_id|. If |
+ // the image does not exist, we fall back to the default image. |
+ void LoadFaviconImage(int request_id); |
+ // FaviconService callback |
+ void OnFaviconDataAvailable( |
+ int request_id, |
+ const chrome::FaviconBitmapResult& bitmap_result); |
+ |
+ // ImageLoader callback |
+ void OnImageLoaded(int request_id, const gfx::Image& image); |
+ |
+ // Called when the extension doesn't have an icon. We fall back to multiple |
+ // sources, using the following order: |
+ // 1) The icons as listed in the extension / app manifests. |
+ // 2) If a 16px icon and the extension has a launch URL, see if Chrome |
+ // has a corresponding favicon. |
+ // 3) If still no matches, load the default extension / application icon. |
+ void LoadIconFailed(int request_id); |
+ |
// Parses and savse an ExtensionIconRequest for the URL |path| for the |
// specified |request_id|. |
bool ParseData(const std::string& path, |
@@ -116,9 +146,18 @@ |
Profile* profile_; |
+ // Maps tracker ids to request ids. |
+ std::map<int, int> tracker_map_; |
+ |
// Maps request_ids to ExtensionIconRequests. |
std::map<int, ExtensionIconRequest*> request_map_; |
+ scoped_ptr<SkBitmap> default_app_data_; |
+ |
+ scoped_ptr<SkBitmap> default_extension_data_; |
+ |
+ CancelableTaskTracker cancelable_task_tracker_; |
+ |
DISALLOW_COPY_AND_ASSIGN(ExtensionIconSource); |
}; |