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

Unified Diff: chrome/browser/cocoa/extensions/browser_actions_controller.mm

Issue 3054040: [Mac] Adjust browser-action and content-setting popup points (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: Merge to LKGR. Created 10 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 | « no previous file | chrome/browser/cocoa/location_bar/content_setting_decoration.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « no previous file | chrome/browser/cocoa/location_bar/content_setting_decoration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698