Index: chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm |
diff --git a/chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm b/chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm |
index 5c7346849aa51c49137999eca90afff45ff5d865..e377d18efcb6cf6726cc39d922123ffb4de0a951 100644 |
--- a/chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm |
+++ b/chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm |
@@ -7,6 +7,7 @@ |
#include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
#include "chrome/browser/tab_contents/infobar.h" |
#import "chrome/browser/ui/cocoa/animatable_view.h" |
+#import "chrome/browser/ui/cocoa/browser_window_controller.h" |
#import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
#import "chrome/browser/ui/cocoa/infobars/infobar_controller.h" |
#import "chrome/browser/ui/cocoa/view_id_util.h" |
@@ -125,6 +126,13 @@ class InfoBarNotificationObserver : public NotificationObserver { |
[self positionInfoBarsAndRedraw]; |
} |
+- (BrowserWindowController*)browserWindowController { |
+ id controller = [[[self view] window] windowController]; |
+ if (![controller isKindOfClass:[BrowserWindowController class]]) |
+ return nil; |
+ return controller; |
+} |
+ |
- (void)changeTabContents:(TabContentsWrapper*)contents { |
registrar_.RemoveAll(); |
[self removeAllInfoBars]; |
@@ -158,8 +166,8 @@ class InfoBarNotificationObserver : public NotificationObserver { |
return [infobarControllers_ count] - [closingInfoBars_ count]; |
} |
-- (CGFloat)antiSpoofHeight { |
- return 0; |
+- (CGFloat)overlappingTipHeight { |
+ return [self infobarCount] ? infobars::kTipHeight : 0; |
} |
- (void)resizeView:(NSView*)view newHeight:(CGFloat)height { |
@@ -180,8 +188,17 @@ class InfoBarNotificationObserver : public NotificationObserver { |
- (CGFloat)desiredHeight { |
CGFloat height = 0; |
+ |
+ // Take out the height of the tip from the total size of the infobar so that |
+ // the tip overlaps the preceding infobar when there is more than one infobar. |
for (InfoBarController* controller in infobarControllers_.get()) |
- height += NSHeight([[controller view] frame]); |
+ height += NSHeight([[controller view] frame]) - infobars::kTipHeight; |
+ |
+ // If there are any infobars, add a little extra room for the tip of the first |
+ // infobar. |
+ if (height) |
+ height += infobars::kTipHeight; |
+ |
return height; |
} |
@@ -243,7 +260,7 @@ class InfoBarNotificationObserver : public NotificationObserver { |
frame.size.width = NSWidth(containerBounds); |
[view setFrame:frame]; |
- minY += NSHeight(frame); |
+ minY += NSHeight(frame) - infobars::kTipHeight; |
} |
[resizeDelegate_ resizeView:[self view] newHeight:[self desiredHeight]]; |