Chromium Code Reviews| Index: chrome/common/extensions/extension_action.h |
| diff --git a/chrome/common/extensions/extension_action.h b/chrome/common/extensions/extension_action.h |
| index b5a13392509308a7f493abdff4adc7cd468ecae7..ccba1b0b42286a3fb4993768423f2203960fb4d9 100644 |
| --- a/chrome/common/extensions/extension_action.h |
| +++ b/chrome/common/extensions/extension_action.h |
| @@ -12,8 +12,10 @@ |
| #include "base/basictypes.h" |
| #include "base/memory/linked_ptr.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "base/memory/scoped_vector.h" |
| #include "base/memory/weak_ptr.h" |
| #include "base/observer_list.h" |
| +#include "chrome/common/extensions/extension_icon_set.h" |
| #include "third_party/skia/include/core/SkColor.h" |
| #include "ui/base/animation/linear_animation.h" |
| @@ -159,32 +161,25 @@ class ExtensionAction { |
| // bitmap or a path. However, conceptually, there is only one default icon. |
| // Setting the default icon using a path clears the bitmap and vice-versa. |
| - // Since ExtensionAction, living in common/, can't interact with the browser |
| - // to load images, the UI code needs to load the icon. Load the image there |
| - // using an ImageLoadingTracker and call CacheIcon(image) with the result. |
| - // |
| - // If an image is cached redundantly, the first load will be used. |
| - void CacheIcon(const gfx::Image& icon); |
| - |
| // Set this action's icon bitmap on a specific tab. |
| void SetIcon(int tab_id, const gfx::Image& image); |
| - // Get the icon for a tab, or the default if no icon was set for this tab, |
| - // retrieving icons that have been specified by path from the previous |
| - // arguments to CacheIcon(). If the default icon isn't found in the cache, |
| - // returns the puzzle piece icon. |
| - gfx::Image GetIcon(int tab_id) const; |
| + // Applies the attention and animation image transformations registered for |
| + // the tab on the provided icon. |
| + gfx::Image ApplyAttentionAndAnimation(const gfx::ImageSkia& icon, |
|
Jeffrey Yasskin
2012/09/14 23:47:12
At some point, the icon-manipulation code should m
tbarzic
2012/09/15 00:29:10
yeah, I agree..
|
| + int tab_id) const; |
| // Gets the icon that has been set using |SetIcon| for the tab. |
| gfx::ImageSkia GetExplicitlySetIcon(int tab_id) const; |
| // Non-tab-specific icon path. This is used to support the default_icon key of |
| // page and browser actions. |
| - void set_default_icon_path(const std::string& path) { |
| - default_icon_path_ = path; |
| + void set_default_icon(scoped_ptr<ExtensionIconSet> icon_set) { |
| + default_icon_ = icon_set.Pass(); |
| } |
| - const std::string& default_icon_path() const { |
| - return default_icon_path_; |
| + |
| + const ExtensionIconSet* default_icon() const { |
| + return default_icon_.get(); |
| } |
| // Set this action's badge text on a specific tab. |
| @@ -252,6 +247,11 @@ class ExtensionAction { |
| gfx::ImageSkia ApplyIconAnimation(int tab_id, |
| const gfx::ImageSkia& orig) const; |
| + // Returns width of the current icon for tab_id. |
| + // TODO(tbarzic): The icon selection is done in ExtensionActionIconFactory. |
| + // We should probably move this there too. |
| + int GetIconWidth(int tab_id) const; |
| + |
| // Paints badge with specified parameters to |canvas|. |
| static void DoPaintBadge(gfx::Canvas* canvas, |
| const gfx::Rect& bounds, |
| @@ -306,15 +306,14 @@ class ExtensionAction { |
| // NULLs to prevent the map from growing without bound. |
| mutable std::map<int, base::WeakPtr<IconAnimation> > icon_animation_; |
| - std::string default_icon_path_; |
| + // ExtensionIconSet containing paths to bitmaps from which default icon's |
| + // image representations will be selected. |
| + scoped_ptr<const ExtensionIconSet> default_icon_; |
| // The id for the ExtensionAction, for example: "RssPageAction". This is |
| // needed for compat with an older version of the page actions API. |
| std::string id_; |
| - // Saves the arguments from CacheIcon() calls. |
| - scoped_ptr<gfx::ImageSkia> cached_icon_; |
| - |
| // True if the ExtensionAction's settings have changed from what was |
| // specified in the manifest. |
| bool has_changed_; |