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

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

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.cc
diff --git a/chrome/browser/ui/views/toolbar/browser_action_view.cc b/chrome/browser/ui/views/toolbar/browser_action_view.cc
index 780e8c365efc650fa5fb270f81e98e1f88e85532..ddd873449441778107023a219cb08937df954fd5 100644
--- a/chrome/browser/ui/views/toolbar/browser_action_view.cc
+++ b/chrome/browser/ui/views/toolbar/browser_action_view.cc
@@ -115,6 +115,7 @@ BrowserActionButton::BrowserActionButton(const Extension* extension,
BrowserActionView::Delegate* delegate)
: MenuButton(this, base::string16(), NULL, false),
browser_(browser),
+ icon_observer_(NULL),
Finnur 2014/02/10 11:20:57 Move this line down one to avoid compile error see
browser_action_(
extensions::ExtensionActionManager::Get(browser->profile())->
GetBrowserAction(*extension)),
@@ -311,6 +312,15 @@ void BrowserActionButton::Observe(int type,
void BrowserActionButton::OnIconUpdated() {
UpdateState();
+ if (icon_observer_) {
+ int tab_id = delegate_->GetCurrentTabId();
+ gfx::Size spacing(0, ToolbarView::kVertSpacing);
+ gfx::ImageSkia icon = *icon_factory_.GetIcon(tab_id).ToImageSkia();
+ if (!IsEnabled(tab_id))
+ icon = gfx::ImageSkiaOperations::CreateTransparentImage(icon, .25);
Finnur 2014/02/10 10:41:41 This is copied almost verbatim from GetIconWithBad
+ icon_observer_->OnIconUpdated(
+ browser_action_->GetIconWithBadge(icon, tab_id, spacing));
+ }
}
bool BrowserActionButton::Activate() {

Powered by Google App Engine
This is Rietveld 408576698