Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Unified Diff: chrome/browser/ui/views/location_bar/page_action_image_view.h

Issue 10905005: Change browser/page action default icon defined in manifest to support hidpi. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 8e1118d866b3f26a70a195980682878e510ed167..bc382f878aa0b51fc5b1cd658085f3727332881e 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;
@@ -104,9 +102,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_;

Powered by Google App Engine
This is Rietveld 408576698