| 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..fba3518d9faee19a6dfd883238ce8b7176c92128 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,18 @@ 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];
|
| + anchor = location_bar->GetPageInfoBubblePoint();
|
| + } else {
|
| + // Center the bubble if there's no location bar.
|
| + NSView* content_view = [parent_window_ contentView];
|
| + anchor.y = NSMaxY(content_view.frame);
|
| + anchor.x = NSMidX(content_view.frame);
|
| + }
|
| +
|
| return [parent_window_ convertBaseToScreen:anchor];
|
| }
|
|
|
| @@ -77,3 +85,20 @@ NSWindow* PermissionBubbleCocoa::window() {
|
| void PermissionBubbleCocoa::SwitchParentWindow(NSWindow* parent) {
|
| parent_window_ = parent;
|
| }
|
| +
|
| +bool PermissionBubbleCocoa::HasLocationBar() {
|
| + LocationBarViewMac* location_bar_bridge =
|
| + [[parent_window_ windowController] locationBarBridge];
|
| + if (location_bar_bridge) {
|
| + // It is necessary to check that the location bar bridge will actually
|
| + // support the location bar. This is important because an application window
|
| + // will have a location_bar_bridge but not have a location bar.
|
| + return location_bar_bridge->browser()->SupportsWindowFeature(
|
| + Browser::FEATURE_LOCATIONBAR);
|
| + }
|
| + return false;
|
| +}
|
| +
|
| +info_bubble::BubbleArrowLocation PermissionBubbleCocoa::GetArrowLocation() {
|
| + return HasLocationBar() ? info_bubble::kTopLeft : info_bubble::kNoArrow;
|
| +}
|
|
|