Chromium Code Reviews| Index: chrome/browser/cocoa/extensions/browser_actions_controller.mm |
| diff --git a/chrome/browser/cocoa/extensions/browser_actions_controller.mm b/chrome/browser/cocoa/extensions/browser_actions_controller.mm |
| index cded5e90978cbeba71ee370a5355c21d804aed4f..8295ee91612ca4acb329fe4002a08b50dbddb122 100644 |
| --- a/chrome/browser/cocoa/extensions/browser_actions_controller.mm |
| +++ b/chrome/browser/cocoa/extensions/browser_actions_controller.mm |
| @@ -57,6 +57,10 @@ const CGFloat kBrowserActionButtonPadding = 2.0; |
| // pixel of internal padding, this needs an extra pixel. |
| const CGFloat kBrowserActionLeftPadding = kBrowserActionButtonPadding + 1.0; |
| +// How far to inset from the bottom of the view to get the top border |
| +// of the popup 2px below the bottom of the Omnibox. |
| +const CGFloat kBrowserActionBubbleYOffset = 3.0; |
| + |
| } // namespace |
| @interface BrowserActionsController(Private) |
| @@ -374,24 +378,20 @@ class ExtensionsServiceObserverBridge : public NotificationObserver, |
| - (NSPoint)popupPointForBrowserAction:(Extension*)extension { |
| if (!extension->browser_action()) |
| return NSZeroPoint; |
| - BrowserActionButton* button = [self buttonForExtension:extension]; |
| + |
| + NSButton* button = [self buttonForExtension:extension]; |
| if (!button) |
| return NSZeroPoint; |
| - NSView* view = button; |
| - BOOL isHidden = [hiddenButtons_ containsObject:button]; |
| - if (isHidden) |
| - view = chevronMenuButton_.get(); |
| - |
| - NSPoint arrowPoint = [view frame].origin; |
| - // Adjust the anchor point to be at the center of the browser action button |
| - // or chevron. |
| - arrowPoint.x += NSWidth([view frame]) / 2; |
| - // Move the arrow up a bit in the case that it's pointing to the chevron. |
| - if (isHidden) |
| - arrowPoint.y += NSHeight([view frame]) / 4; |
| + if ([hiddenButtons_ containsObject:button]) |
| + button = chevronMenuButton_.get(); |
| - return [[view superview] convertPoint:arrowPoint toView:nil]; |
| + // Anchor point just above the center of the bottom. |
| + const NSRect bounds = [button bounds]; |
| + DCHECK([button isFlipped]); |
|
Bons
2010/08/03 21:11:49
isFlipped is deprecated on 10.6 so we don't use it
Scott Hess - ex-Googler
2010/08/03 21:22:50
The -isFlipped of the button affects whether the c
Bons
2010/08/03 21:40:36
Ah you're right. No worries. As needed.
|
| + NSPoint anchor = NSMakePoint(NSMidX(bounds), |
| + NSMaxY(bounds) - kBrowserActionBubbleYOffset); |
| + return [button convertPoint:anchor toView:nil]; |
| } |
| - (BOOL)chevronIsHidden { |