| Index: chrome/browser/ui/gtk/location_bar_view_gtk.cc
|
| diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
|
| index 7128bdea23a524ca48a0eb594cdacc8d1bbbd0b5..921b63b252f17d6683de4cf39af8e1e37ff57fc6 100644
|
| --- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc
|
| +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
|
| @@ -731,9 +731,9 @@ void LocationBarViewGtk::UpdatePageActions() {
|
|
|
| TabContents* tab_contents = GetTabContents();
|
| if (tab_contents) {
|
| - LocationBarController* controller =
|
| + LocationBarController* location_bar_controller =
|
| tab_contents->extension_tab_helper()->location_bar_controller();
|
| - new_page_actions = controller->GetCurrentActions();
|
| + new_page_actions = location_bar_controller->GetCurrentActions();
|
| }
|
|
|
| // Initialize on the first call, or re-initialize if more extensions have been
|
| @@ -1664,6 +1664,11 @@ LocationBarViewGtk::PageActionViewGtk::PageActionViewGtk(
|
| ImageLoadingTracker::DONT_CACHE);
|
| }
|
|
|
| + icon_animation_ = page_action->GetIconAnimation(
|
| + owner->GetTabContents()->extension_tab_helper()->tab_id());
|
| + if (icon_animation_.get())
|
| + icon_animation_->AddObserver(this);
|
| +
|
| // We set the owner last of all so that we can determine whether we are in
|
| // the process of initializing this class or not.
|
| owner_ = owner;
|
| @@ -1672,6 +1677,9 @@ LocationBarViewGtk::PageActionViewGtk::PageActionViewGtk(
|
| LocationBarViewGtk::PageActionViewGtk::~PageActionViewGtk() {
|
| DisconnectPageActionAccelerator();
|
|
|
| + if (icon_animation_.get())
|
| + icon_animation_->RemoveObserver(this);
|
| +
|
| image_.Destroy();
|
| event_box_.Destroy();
|
| for (PixbufMap::iterator iter = pixbufs_.begin(); iter != pixbufs_.end();
|
| @@ -1735,8 +1743,19 @@ void LocationBarViewGtk::PageActionViewGtk::UpdateVisibility(
|
| }
|
| }
|
| // The pixbuf might not be loaded yet.
|
| - if (pixbuf)
|
| - gtk_image_set_from_pixbuf(GTK_IMAGE(image_.get()), pixbuf);
|
| + if (pixbuf) {
|
| + if (icon_animation_.get()) {
|
| + // Draw |pixbuf| with the fade-in |icon_animation_| applied to it.
|
| + // Use a temporary gfx::Image to do the conversion to/from a SkBitmap.
|
| + g_object_ref(pixbuf); // don't let gfx::Image take ownership.
|
| + gfx::Image animated_image(
|
| + icon_animation_->Apply(*gfx::Image(pixbuf).ToSkBitmap()));
|
| + gtk_image_set_from_pixbuf(GTK_IMAGE(image_.get()),
|
| + animated_image.ToGdkPixbuf());
|
| + } else {
|
| + gtk_image_set_from_pixbuf(GTK_IMAGE(image_.get()), pixbuf);
|
| + }
|
| + }
|
| }
|
|
|
| bool old_visible = IsVisible();
|
| @@ -1775,11 +1794,10 @@ void LocationBarViewGtk::PageActionViewGtk::OnImageLoaded(
|
| pixbufs_[page_action_->default_icon_path()] = pixbuf;
|
| }
|
|
|
| - // If we have no owner, that means this class is still being constructed and
|
| - // we should not UpdatePageActions, since it leads to the PageActions being
|
| - // destroyed again and new ones recreated (causing an infinite loop).
|
| - if (owner_)
|
| - owner_->UpdatePageActions();
|
| + // If we have no owner, that means this class is still being constructed.
|
| + TabContents* tab_contents = owner_ ? owner_->GetTabContents() : NULL;
|
| + if (tab_contents)
|
| + UpdateVisibility(tab_contents->web_contents(), current_url_);
|
| }
|
|
|
| void LocationBarViewGtk::PageActionViewGtk::TestActivatePageAction() {
|
| @@ -1842,6 +1860,11 @@ void LocationBarViewGtk::PageActionViewGtk::ConnectPageActionAccelerator() {
|
| }
|
| }
|
|
|
| +void LocationBarViewGtk::PageActionViewGtk::OnIconChanged(
|
| + const ExtensionAction::IconAnimation& animation) {
|
| + UpdateVisibility(owner_->GetWebContents(), current_url_);
|
| +}
|
| +
|
| void LocationBarViewGtk::PageActionViewGtk::DisconnectPageActionAccelerator() {
|
| if (accel_group_) {
|
| gtk_accel_group_disconnect_key(
|
|
|