Commit f591313c authored by Alan Cutter's avatar Alan Cutter Committed by Commit Bot

Fix permission bubble anchoring for hosted app windows

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/1004886Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Commit-Queue: Alan Cutter <alancutter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550514}
parent d9efd422
...@@ -22,17 +22,15 @@ views::View* GetPageInfoAnchorView(Browser* browser, Anchor anchor) { ...@@ -22,17 +22,15 @@ views::View* GetPageInfoAnchorView(Browser* browser, Anchor anchor) {
if (views_mode_controller::IsViewsBrowserCocoa()) if (views_mode_controller::IsViewsBrowserCocoa())
return nullptr; return nullptr;
#endif #endif
if (!browser->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR))
return nullptr; // Fall back to GetAnchorPoint().
BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); 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(); return browser_view->GetLocationBarView()->GetSecurityBubbleAnchorView();
if (anchor == kAppMenuButton) }
return browser_view->toolbar_button_provider()->GetAppMenuButton(); // Fall back to menu button if no location bar present.
NOTREACHED(); return browser_view->toolbar_button_provider()->GetAppMenuButton();
return nullptr;
} }
gfx::Rect GetPageInfoAnchorRect(Browser* browser) { gfx::Rect GetPageInfoAnchorRect(Browser* browser) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment