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..908de9b63e786bfb7f591480a3bdec5defb9962d 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(); |
@@ -206,9 +200,7 @@ class BrowserActionButton : public content::NotificationObserver, |
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())); |
+ loaded_icons_[extension_->browser_action()->default_icon_path()] = image; |
} |
not at google - send to devlin
2012/07/26 02:29:44
nit: remove surrounding {}
Jeffrey Yasskin
2012/07/26 21:11:47
Done.
|
UpdateState(); |
} |
@@ -226,15 +218,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()); |
} |
not at google - send to devlin
2012/07/26 02:29:44
same nit
Jeffrey Yasskin
2012/07/26 21:11:47
Ah the perils of removing code. :)
|
bool enabled = extension_->browser_action()->GetIsVisible(tab_id); |
gtk_widget_set_sensitive(button(), enabled); |
@@ -243,13 +230,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 +443,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_; |