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

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

Issue 10703090: Turn pageAction.show -> browserAction.sensibleThing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: views (incomplete) Created 8 years, 5 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
« no previous file with comments | « chrome/browser/ui/views/browser_action_view.h ('k') | chrome/chrome_common.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « chrome/browser/ui/views/browser_action_view.h ('k') | chrome/chrome_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698