diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-19 20:23:56 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-19 20:23:56 +0000 |
commit | f4ca6ede54f63288a6aba8a40a609194d692dda0 (patch) | |
tree | 6f83ff4b6fd4221cf9b8d1b625ac3b97752d6fa5 /chrome/browser/gtk/browser_actions_toolbar_gtk.cc | |
parent | aa987d73f5c7a29ea56cf9d5126ac1b4f4cc1d92 (diff) | |
download | chromium_src-f4ca6ede54f63288a6aba8a40a609194d692dda0.zip chromium_src-f4ca6ede54f63288a6aba8a40a609194d692dda0.tar.gz chromium_src-f4ca6ede54f63288a6aba8a40a609194d692dda0.tar.bz2 |
GTK: Calling chrome.browserAction.setIcon shouldn't hide tooltips.
Previously, when a browser action's icon changes, it caused the gtk widget
tree to be modified, which hid all tooltips. This was a problem because
several popular extensions called setIcon on a timer of a few seconds.
BUG=37489
TEST=none
Review URL: http://codereview.chromium.org/1547036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44940 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/browser_actions_toolbar_gtk.cc')
-rw-r--r-- | chrome/browser/gtk/browser_actions_toolbar_gtk.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/gtk/browser_actions_toolbar_gtk.cc index bbd54db..da9169be 100644 --- a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc +++ b/chrome/browser/gtk/browser_actions_toolbar_gtk.cc @@ -77,6 +77,7 @@ class BrowserActionButton : public NotificationObserver, Extension* extension) : toolbar_(toolbar), extension_(extension), + image_(NULL), tracker_(this), tab_specific_icon_(NULL), default_icon_(NULL) { @@ -234,8 +235,12 @@ class BrowserActionButton : public NotificationObserver, } void SetImage(GdkPixbuf* image) { - gtk_button_set_image(GTK_BUTTON(button_.get()), - gtk_image_new_from_pixbuf(image)); + if (!image_) { + image_ = gtk_image_new_from_pixbuf(image); + gtk_button_set_image(GTK_BUTTON(button_.get()), image_); + } else { + gtk_image_set_from_pixbuf(GTK_IMAGE(image_), image); + } } static gboolean OnButtonPress(GtkWidget* widget, @@ -295,6 +300,12 @@ class BrowserActionButton : public NotificationObserver, // The gtk widget for this browser action. OwnedWidgetGtk button_; + // The one image subwidget in |button_|. We keep this out so we don't alter + // the widget hierarchy while changing the button image because changing the + // GTK widget hierarchy invalidates all tooltips and several popular + // extensions change browser action icon in a loop. + GtkWidget* image_; + // Loads the button's icons for us on the file thread. ImageLoadingTracker tracker_; |