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

Unified Diff: chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm

Issue 2233293003: Position Mac permission bubbles on the left when in fullscreen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 4 years, 4 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/cocoa/website_settings/permission_bubble_controller.mm
diff --git a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
index 3746bf4223434a3d1158981183746b988977583a..101d6a15106a33be6569223b1f0211c3cf661900 100644
--- a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
@@ -65,6 +65,8 @@
const CGFloat kBubbleMinWidth = 315.0f;
const NSSize kPermissionIconSize = {18, 18};
+const NSInteger kFullscreenLeftOffset = 40;
+
} // namespace
// NSPopUpButton with a menu containing two items: allow and block.
@@ -208,6 +210,10 @@ - (void)onBlock:(id)sender;
// Called when the 'close' button is pressed.
- (void)onClose:(id)sender;
+// Returns the constant offset from the left to use for fullscreen permission
+// bubbles. Only used in tests.
++ (NSInteger)getFullscreenLeftOffset;
+
// Sets the width of both |viewA| and |viewB| to be the larger of the
// two views' widths. Does not change either view's origin or height.
+ (CGFloat)matchWidthsOf:(NSView*)viewA andOf:(NSView*)viewB;
@@ -256,9 +262,11 @@ + (NSPoint)getAnchorPointForBrowser:(Browser*)browser {
[[parentWindow windowController] locationBarBridge];
anchor = location_bar->GetPageInfoBubblePoint();
} else {
- // Center the bubble if there's no location bar.
+ // Position the bubble on the left of the screen if there is no page info
+ // button to point at.
NSRect contentFrame = [[parentWindow contentView] frame];
- anchor = NSMakePoint(NSMidX(contentFrame), NSMaxY(contentFrame));
+ anchor = NSMakePoint(NSMinX(contentFrame) + kFullscreenLeftOffset,
+ NSMaxY(contentFrame));
}
return ui::ConvertPointFromWindowToScreen(parentWindow, anchor);
@@ -484,8 +492,7 @@ - (bool)hasVisibleLocationBar {
}
- (info_bubble::BubbleArrowLocation)getExpectedArrowLocation {
- return [self hasVisibleLocationBar] ? info_bubble::kTopLeft
- : info_bubble::kNoArrow;
+ return info_bubble::kTopLeft;
}
- (NSWindow*)getExpectedParentWindow {
@@ -620,6 +627,10 @@ - (void)onClose:(id)sender {
delegate_->Closing();
}
++ (NSInteger)getFullscreenLeftOffset {
+ return kFullscreenLeftOffset;
+}
+
- (void)activateTabWithContents:(content::WebContents*)newContents
previousContents:(content::WebContents*)oldContents
atIndex:(NSInteger)index

Powered by Google App Engine
This is Rietveld 408576698