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..4b415a98620311f159da7bf560a0e7f8ba42c0cb 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 (HasLocationBar()) { |
| + LocationBarViewMac* location_bar = |
| + [[parent_window_ windowController] locationBarBridge]; |
| + DCHECK(location_bar); |
| + anchor = location_bar->GetPageInfoBubblePoint(); |
| + } else { |
| + // Center the bubble if there's no location bar. |
| + 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::HasLocationBar() { |
| + LocationBarViewMac* location_bar = |
| + [[parent_window_ windowController] locationBarBridge]; |
| + if (location_bar) { |
|
groby-ooo-7-16
2015/04/01 00:19:14
Please add a comment why even if we have a locatio
hcarmona
2015/04/02 01:30:14
Done.
|
| + return location_bar->browser()->SupportsWindowFeature( |
| + Browser::FEATURE_LOCATIONBAR); |
| + } |
| + return false; |
| +} |
| + |
| +info_bubble::BubbleArrowLocation PermissionBubbleCocoa::GetArrowLocation() { |
| + return HasLocationBar() ? info_bubble::kTopLeft : info_bubble::kNoArrow; |
| +} |