Index: chrome/browser/ui/views/browser_action_view.cc |
diff --git a/chrome/browser/ui/views/browser_action_view.cc b/chrome/browser/ui/views/browser_action_view.cc |
index 3922d68a74e0c69b131c1ff8aa6c014e22a87131..eed6f76a6feaae504d4b0f524e519e595c2d59ee 100644 |
--- a/chrome/browser/ui/views/browser_action_view.cc |
+++ b/chrome/browser/ui/views/browser_action_view.cc |
@@ -100,6 +100,16 @@ void BrowserActionButton::ViewHierarchyChanged( |
MenuButton::ViewHierarchyChanged(is_add, parent, child); |
} |
+bool BrowserActionButton::IsEnabled() const { |
+ int tab_id = panel_->GetCurrentTabId(); |
+ if (tab_id < 0) { |
+ // Default is "true" because disabled is the uncommon state. |
+ return true; |
+ } |
+ |
+ return browser_action()->GetIsVisible(tab_id); |
+} |
+ |
bool BrowserActionButton::CanHandleAccelerators() const { |
// View::CanHandleAccelerators() checks to see if the view is visible before |
// allowing it to process accelerators. This is not appropriate for browser |
@@ -128,10 +138,17 @@ void BrowserActionButton::UpdateState() { |
if (tab_id < 0) |
return; |
+ // XXX: this needs to cooperate with SetButton(Not)Pushed. |
+ SetState(IsEnabled() ? |
+ views::CustomButton::BS_NORMAL : |
+ views::CustomButton::BS_DISABLED); |
+ |
SkBitmap icon(browser_action()->GetIcon(tab_id)); |
if (icon.isNull()) |
icon = default_icon_; |
if (!icon.isNull()) { |
+ icon = browser_action()->RenderIconVisibility(icon, tab_id); |
+ |
SkPaint paint; |
paint.setXfermode(SkXfermode::Create(SkXfermode::kSrcOver_Mode)); |
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |