Chromium Code Reviews| Index: chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.mm |
| diff --git a/chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.mm b/chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.mm |
| index 821ddcad6490138052970976561d42895480dfeb..86533a5c917ecb94923ae0da5a0bd4f42c36ccda 100644 |
| --- a/chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.mm |
| +++ b/chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.mm |
| @@ -63,10 +63,19 @@ void PermissionBubbleCocoa::OnBubbleClosing() { |
| } |
| NSPoint PermissionBubbleCocoa::GetAnchorPoint() { |
| - LocationBarViewMac* location_bar = |
| - [[parent_window_ windowController] locationBarBridge]; |
| - DCHECK(location_bar); |
| - NSPoint anchor = location_bar->GetPageInfoBubblePoint(); |
| + NSPoint anchor; |
| + if (HasOmnibar()) { |
| + LocationBarViewMac* location_bar = |
| + [[parent_window_ windowController] locationBarBridge]; |
| + DCHECK(location_bar); |
| + anchor = location_bar->GetPageInfoBubblePoint(); |
| + } else { |
| + // Center the bubble if there's no omnibar. |
| + NSView* content_view = parent_window_.contentView; |
| + anchor.y = content_view.frame.size.height; |
| + anchor.x = (content_view.frame.size.width) / 2; |
| + } |
| + |
| return [parent_window_ convertBaseToScreen:anchor]; |
| } |
| @@ -77,3 +86,17 @@ NSWindow* PermissionBubbleCocoa::window() { |
| void PermissionBubbleCocoa::SwitchParentWindow(NSWindow* parent) { |
| parent_window_ = parent; |
| } |
| + |
| +bool PermissionBubbleCocoa::HasOmnibar() { |
|
groby-ooo-7-16
2015/03/16 22:09:35
Please add tests.
hcarmona
2015/03/30 20:44:28
Done.
|
| + LocationBarViewMac* location_bar = |
| + [[parent_window_ windowController] locationBarBridge]; |
| + if (location_bar) { |
| + return location_bar->browser()->SupportsWindowFeature( |
| + Browser::FEATURE_LOCATIONBAR); |
| + } |
| + return false; |
| +} |
| + |
| +info_bubble::BubbleArrowLocation PermissionBubbleCocoa::GetArrowLocation() { |
| + return HasOmnibar() ? info_bubble::kTopLeft : info_bubble::kNoArrow; |
| +} |