Skip to content

Commit

Permalink
Fix permission bubble anchoring for hosted app windows
Browse files Browse the repository at this point in the history
This CL fixes the anchor point for permission bubbles in hosted app
windows where there is no location bar to anchor to. Instead they
anchor to the app menu button in the title bar. Previously they would
anchor to the top left of the window.

Before:
https://bugs.chromium.org/p/chromium/issues/attachment?aid=333976&signed_aid=xJPvJxrv89kmG6kAZhF0BQ==&inline=1

After (without location bar):
https://bugs.chromium.org/p/chromium/issues/attachment?aid=333977&signed_aid=9OR5wJQecvy4ZcBjUBU7hA==&inline=1

After (with location bar):
https://bugs.chromium.org/p/chromium/issues/attachment?aid=334359&signed_aid=dcPRBhCpeAmfmG5ixtDJ_w==&inline=1

This change does not affect regular tabbed browser windows.

Bug: 814532
Change-Id: I51f87b710764d4f156834e4fa9ce0e7e10450ad8
Reviewed-on: https://chromium-review.googlesource.com/1004886
Reviewed-by: Bret Sepulveda <bsep@chromium.org>
Commit-Queue: Alan Cutter <alancutter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550514}
  • Loading branch information
alancutter authored and Commit Bot committed Apr 13, 2018
1 parent d9efd42 commit f591313
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions chrome/browser/ui/views/bubble_anchor_util_views.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,15 @@ views::View* GetPageInfoAnchorView(Browser* browser, Anchor anchor) {
if (views_mode_controller::IsViewsBrowserCocoa())
return nullptr;
#endif
if (!browser->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR))
return nullptr; // Fall back to GetAnchorPoint().

BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser);

if (anchor == kLocationBar)
if (anchor == kLocationBar &&
browser->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR) &&
browser_view->GetLocationBarView()->visible()) {
return browser_view->GetLocationBarView()->GetSecurityBubbleAnchorView();
if (anchor == kAppMenuButton)
return browser_view->toolbar_button_provider()->GetAppMenuButton();
NOTREACHED();
return nullptr;
}
// Fall back to menu button if no location bar present.
return browser_view->toolbar_button_provider()->GetAppMenuButton();
}

gfx::Rect GetPageInfoAnchorRect(Browser* browser) {
Expand Down

0 comments on commit f591313

Please sign in to comment.