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

Unified Diff: chrome/browser/ui/views/toolbar/browser_action_view.h

Issue 148143004: Add notification mechanism when BrowserActionButton's icon has been updated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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/toolbar/browser_action_view.h
diff --git a/chrome/browser/ui/views/toolbar/browser_action_view.h b/chrome/browser/ui/views/toolbar/browser_action_view.h
index 7d8991964e172bb160ed14f9246e6dfbba420f01..118485cf915914c55b3430eaf50f70ad2cd7116e 100644
--- a/chrome/browser/ui/views/toolbar/browser_action_view.h
+++ b/chrome/browser/ui/views/toolbar/browser_action_view.h
@@ -111,6 +111,18 @@ class BrowserActionButton : public views::MenuButton,
public content::NotificationObserver,
public ExtensionActionIconFactory::Observer {
public:
+ // The IconObserver will receive a notification when the button's icon has
+ // been updated.
+ class IconObserver {
+ public:
+ virtual ~IconObserver() {}
+ virtual void OnIconUpdated(const gfx::ImageSkia& icon) = 0;
+ };
+
+ void set_icon_observer(IconObserver* icon_observer) {
+ icon_observer_ = icon_observer;
+ }
+
BrowserActionButton(const extensions::Extension* extension,
Browser* browser_,
BrowserActionView::Delegate* delegate);
@@ -177,6 +189,9 @@ class BrowserActionButton : public views::MenuButton,
// Returns icon factory for the button.
ExtensionActionIconFactory& icon_factory() { return icon_factory_; }
+ // Gets the icon of this button and its badge.
+ gfx::ImageSkia GetIconWithBadge();
+
// Returns button icon so it can be accessed during tests.
gfx::ImageSkia GetIconForTest();
@@ -230,6 +245,10 @@ class BrowserActionButton : public views::MenuButton,
// Responsible for running the menu.
scoped_ptr<views::MenuRunner> menu_runner_;
+ // The observer that we need to notify when the icon of the button has been
+ // updated.
+ IconObserver* icon_observer_;
+
friend class base::DeleteHelper<BrowserActionButton>;
DISALLOW_COPY_AND_ASSIGN(BrowserActionButton);

Powered by Google App Engine
This is Rietveld 408576698