Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: trunk/src/chrome/browser/ui/webui/extensions/extension_icon_source.h

Issue 26511002: Revert 227477 "Refactored loading of applications / extensions i..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
};

Powered by Google App Engine
This is Rietveld 408576698