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

Unified Diff: chrome/browser/ui/cocoa/extensions/browser_action_button.mm

Issue 10963016: Fix disabled browser action appearance on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: thakis's Created 8 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/extensions/browser_action_button.mm
diff --git a/chrome/browser/ui/cocoa/extensions/browser_action_button.mm b/chrome/browser/ui/cocoa/extensions/browser_action_button.mm
index 93fa87978383e3616d80a6c7d7c75118e876a9a2..f9d93fa4caa3671e8b777f9eef3ef2bf00bcdbe5 100644
--- a/chrome/browser/ui/cocoa/extensions/browser_action_button.mm
+++ b/chrome/browser/ui/cocoa/extensions/browser_action_button.mm
@@ -135,6 +135,8 @@ class ExtensionActionIconFactoryBridge
forButtonState:image_button_cell::kHoverState];
[cell setImageID:IDR_BROWSER_ACTION_P
forButtonState:image_button_cell::kPressedState];
+ [cell setImageID:IDR_BROWSER_ACTION
+ forButtonState:image_button_cell::kDisabledState];
[self setTitle:@""];
[self setButtonType:NSMomentaryChangeButton];
@@ -255,7 +257,7 @@ class ExtensionActionIconFactoryBridge
[[self cell] setTabId:tabId_];
bool enabled = extension_->browser_action()->GetIsVisible(tabId_);
- [self setEnabled:enabled ? YES : NO];
+ [self setEnabled:enabled];
[self setNeedsDisplay:YES];
}
@@ -309,6 +311,7 @@ class ExtensionActionIconFactoryBridge
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {
gfx::ScopedNSGraphicsContextSaveGState scopedGState;
[super drawWithFrame:cellFrame inView:controlView];
+ bool enabled = extensionAction_->GetIsVisible(tabId_);
const NSSize imageSize = self.image.size;
const NSRect imageRect =
NSMakeRect(std::floor((NSWidth(cellFrame) - imageSize.width) / 2.0),
@@ -317,7 +320,7 @@ class ExtensionActionIconFactoryBridge
[self.image drawInRect:imageRect
fromRect:NSZeroRect
operation:NSCompositeSourceOver
- fraction:1.0
+ fraction:enabled ? 1.0 : 0.4
respectFlipped:YES
hints:nil];
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698