Index: chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc |
diff --git a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc |
index 5760d33e7eee1475c89ae81903a804f69812ca89..2dc6b62a97c2a05ded2e61d028afd5f41366ac72 100644 |
--- a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc |
+++ b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc |
@@ -127,12 +127,6 @@ class BrowserActionButton : public content::NotificationObserver, |
gfx::Size(Extension::kBrowserActionIconMaxSize, |
Extension::kBrowserActionIconMaxSize), |
ImageLoadingTracker::DONT_CACHE); |
- } else { |
- const SkBitmap* bm = |
- ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
- IDR_EXTENSIONS_FAVICON).ToSkBitmap(); |
- default_skbitmap_ = *bm; |
- default_icon_ = gfx::GdkPixbufFromSkBitmap(*bm); |
} |
UpdateState(); |
@@ -205,11 +199,8 @@ class BrowserActionButton : public content::NotificationObserver, |
void OnImageLoaded(const gfx::Image& image, |
const std::string& extension_id, |
int index) OVERRIDE { |
- if (!image.IsEmpty()) { |
- default_skbitmap_ = *image.ToSkBitmap(); |
- default_icon_ = |
- static_cast<GdkPixbuf*>(g_object_ref(image.ToGdkPixbuf())); |
- } |
+ if (!image.IsEmpty()) |
+ loaded_icons_[extension_->browser_action()->default_icon_path()] = image; |
UpdateState(); |
} |
@@ -226,16 +217,10 @@ class BrowserActionButton : public content::NotificationObserver, |
else |
gtk_widget_set_tooltip_text(button(), tooltip.c_str()); |
- SkBitmap image = extension_->browser_action()->GetIcon(tab_id); |
- if (!image.isNull()) { |
- GdkPixbuf* previous_gdk_icon = tab_specific_icon_; |
- tab_specific_icon_ = gfx::GdkPixbufFromSkBitmap(image); |
- SetImage(tab_specific_icon_); |
- if (previous_gdk_icon) |
- g_object_unref(previous_gdk_icon); |
- } else if (default_icon_) { |
- SetImage(default_icon_); |
- } |
+ gfx::Image image = extension_->browser_action()->GetIcon( |
+ tab_id, loaded_icons_); |
+ if (!image.IsEmpty()) |
+ SetImage(image.ToGdkPixbuf()); |
bool enabled = extension_->browser_action()->GetIsVisible(tab_id); |
gtk_widget_set_sensitive(button(), enabled); |
@@ -243,13 +228,8 @@ class BrowserActionButton : public content::NotificationObserver, |
} |
SkBitmap GetIcon() { |
- const SkBitmap& image = extension_->browser_action()->GetIcon( |
- toolbar_->GetCurrentTabId()); |
- if (!image.isNull()) { |
- return image; |
- } else { |
- return default_skbitmap_; |
- } |
+ return *extension_->browser_action()->GetIcon( |
+ toolbar_->GetCurrentTabId(), loaded_icons_).ToSkBitmap(); |
} |
MenuGtk* GetContextMenu() { |
@@ -461,6 +441,9 @@ class BrowserActionButton : public content::NotificationObserver, |
// If we are displaying a tab-specific icon, it will be here. |
GdkPixbuf* tab_specific_icon_; |
+ // Icons loaded from paths. Currently just the browser action's default icon. |
+ ExtensionAction::PathToIconCache loaded_icons_; |
+ |
// If the browser action has a default icon, it will be here. |
GdkPixbuf* default_icon_; |