Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7065)

Unified Diff: chrome/browser/ui/views/website_settings/permissions_bubble_view_views.cc

Issue 2109663005: Permission prompts show in the top-left corner in fullscreen mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permission-bubble-detach-from-fullscreen
Patch Set: Take into account RTL displays and multiple monitors. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/website_settings/permissions_bubble_view_views.cc
diff --git a/chrome/browser/ui/views/website_settings/permissions_bubble_view_views.cc b/chrome/browser/ui/views/website_settings/permissions_bubble_view_views.cc
index 3ad8efeae462e7c2b656ef8bdc70823f502c1b55..43ddc952b826c5fd39df2f2e0dc587670f7f32ba 100644
--- a/chrome/browser/ui/views/website_settings/permissions_bubble_view_views.cc
+++ b/chrome/browser/ui/views/website_settings/permissions_bubble_view_views.cc
@@ -12,28 +12,39 @@
#include "chrome/browser/ui/views/location_bar/location_icon_view.h"
#include "chrome/browser/ui/views/website_settings/permissions_bubble_view.h"
#include "ui/gfx/geometry/point.h"
+#include "ui/gfx/geometry/vector2d.h"
// The Views browser implementation of PermissionBubbleViewViews'
// anchor methods. Views browsers have a native View to anchor the bubble to,
// which these functions provide.
+// Left margin for the bubble when anchored to the top of the screen in
+// fullscreen mode.
+const int kFullscreenLeftMargin = 40;
+
views::View* PermissionBubbleViewViews::GetAnchorView() {
BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_);
if (browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR))
return browser_view->GetLocationBarView()->location_icon_view();
- return browser_view->top_container();
+ // Fall back to GetAnchorPoint().
+ return nullptr;
}
gfx::Point PermissionBubbleViewViews::GetAnchorPoint() {
- return gfx::Point();
+ BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_);
+ // Get position in view (taking RTL displays into account).
+ int x_within_browser_view =
+ browser_view->GetMirroredXInView(kFullscreenLeftMargin);
+ // Get position in screen (taking browser view origin into account, which may
+ // not be 0,0 if there are multiple displays).
+ gfx::Point browser_view_origin = browser_view->GetBoundsInScreen().origin();
+ return browser_view_origin + gfx::Vector2d(x_within_browser_view, 0);
}
views::BubbleBorder::Arrow PermissionBubbleViewViews::GetAnchorArrow() {
- if (browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR))
- return views::BubbleBorder::TOP_LEFT;
- return views::BubbleBorder::NONE;
+ return views::BubbleBorder::TOP_LEFT;
}
// static

Powered by Google App Engine
This is Rietveld 408576698