| 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 8dcbca428a3340d1728cc54b4ca246945b1fd4c1..b3c5c63103c531cecbbf321e061e4e52a5d209df 100644
|
| --- a/chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm
|
| +++ b/chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm
|
| @@ -32,8 +32,11 @@
|
| - (id)initWithResizeDelegate:(id<ViewResizer>)resizeDelegate {
|
| DCHECK(resizeDelegate);
|
| if ((self = [super initWithNibName:nil bundle:nil])) {
|
| + // This view and its subviews use autoresizing masks, The starting frame
|
| + // needs to be reasonably large, although its exactly values don't matter.
|
| + // It cannot be NSZeroRect.
|
| base::scoped_nsobject<NSView> view(
|
| - [[NSView alloc] initWithFrame:NSZeroRect]);
|
| + [[NSView alloc] initWithFrame:NSMakeRect(0, 0, 800, 100)]);
|
| [view setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin];
|
| view_id_util::SetID(view, VIEW_ID_INFO_BAR_CONTAINER);
|
| [self setView:view];
|
| @@ -128,17 +131,7 @@
|
| [controller layoutArrow];
|
| }
|
|
|
| - int totalHeight = 0;
|
| - int overlap = containerCocoa_->GetVerticalOverlap(&totalHeight);
|
| -
|
| - if (NSHeight([[self view] frame]) != totalHeight) {
|
| - [resizeDelegate_ resizeView:[self view] newHeight:totalHeight];
|
| - } else if (oldOverlappingTipHeight_ != overlap) {
|
| - // If the infobar overlap changed but the height didn't change then
|
| - // explicitly ask for a layout.
|
| - [[self browserWindowController] layoutInfoBars];
|
| - }
|
| - oldOverlappingTipHeight_ = overlap;
|
| + [resizeDelegate_ resizeView:[self view] newHeight:[self heightOfInfoBars]];
|
| }
|
|
|
| - (void)setShouldSuppressTopInfoBarTip:(BOOL)flag {
|
| @@ -164,4 +157,13 @@
|
| containerCocoa_->SetMaxTopArrowHeight(height);
|
| }
|
|
|
| +- (CGFloat)heightOfInfoBars {
|
| + CGFloat totalHeight = 0;
|
| + for (InfoBarController* controller in infobarControllers_.get()) {
|
| + totalHeight += [controller infobar]->total_height() -
|
| + [controller infobar]->arrow_height();
|
| + }
|
| + return totalHeight;
|
| +}
|
| +
|
| @end
|
|
|