Index: chrome/browser/ui/views/location_bar/page_action_image_view.h |
diff --git a/chrome/browser/ui/views/location_bar/page_action_image_view.h b/chrome/browser/ui/views/location_bar/page_action_image_view.h |
index 474b5c4469c66342cb4169333d36eff9aaa76672..af757bcd7981f8109819197f56f27b6a47d96900 100644 |
--- a/chrome/browser/ui/views/location_bar/page_action_image_view.h |
+++ b/chrome/browser/ui/views/location_bar/page_action_image_view.h |
@@ -9,7 +9,7 @@ |
#include <string> |
#include "base/memory/scoped_ptr.h" |
-#include "chrome/browser/extensions/image_loading_tracker.h" |
+#include "chrome/browser/extensions/extension_action_icon_factory.h" |
#include "chrome/browser/ui/views/extensions/extension_popup.h" |
#include "chrome/common/extensions/extension_action.h" |
#include "ui/views/context_menu_controller.h" |
@@ -29,10 +29,10 @@ class MenuRunner; |
// PageActionImageView is used by the LocationBarView to display the icon for a |
// given PageAction and notify the extension when the icon is clicked. |
class PageActionImageView : public views::ImageView, |
- public ImageLoadingTracker::Observer, |
public views::WidgetObserver, |
public views::ContextMenuController, |
public content::NotificationObserver, |
+ public ExtensionActionIconFactory::Observer, |
public ExtensionAction::IconAnimation::Observer { |
public: |
PageActionImageView(LocationBarView* owner, |
@@ -54,11 +54,6 @@ class PageActionImageView : public views::ImageView, |
virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
- // Overridden from ImageLoadingTracker: |
- virtual void OnImageLoaded(const gfx::Image& image, |
- const std::string& extension_id, |
- int index) OVERRIDE; |
- |
// Overridden from views::WidgetObserver: |
virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; |
@@ -71,6 +66,9 @@ class PageActionImageView : public views::ImageView, |
const content::NotificationSource& source, |
const content::NotificationDetails& details) OVERRIDE; |
+ // Overriden from ExtensionActionIconFactory::Observer. |
+ virtual void OnIconUpdated() OVERRIDE; |
+ |
// Overridden from ui::AcceleratorTarget: |
virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
virtual bool CanHandleAccelerators() const OVERRIDE; |
@@ -103,9 +101,10 @@ class PageActionImageView : public views::ImageView, |
// The corresponding browser. |
Browser* browser_; |
- // The object that is waiting for the image loading to complete |
- // asynchronously. |
- ImageLoadingTracker tracker_; |
+ // The object that page action will use to create icon for us. |
+ // It may load icon asynchronously (in which case initial icon returned by |
+ // the action will be blank), so we have to observe it for icon's updates. |
+ scoped_ptr<ExtensionActionIconFactory> icon_factory_; |
// The tab id we are currently showing the icon for. |
int current_tab_id_; |