OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/mac/mac_util.h" | 6 #include "base/mac/mac_util.h" |
7 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" | 7 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
8 #import "chrome/browser/ui/cocoa/animatable_view.h" | 8 #import "chrome/browser/ui/cocoa/animatable_view.h" |
9 #include "chrome/browser/ui/cocoa/infobars/infobar.h" | 9 #include "chrome/browser/ui/cocoa/infobars/infobar.h" |
10 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 10 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 @implementation InfoBarContainerController (PrivateMethods) | 173 @implementation InfoBarContainerController (PrivateMethods) |
174 | 174 |
175 - (CGFloat)desiredHeight { | 175 - (CGFloat)desiredHeight { |
176 CGFloat height = 0; | 176 CGFloat height = 0; |
177 for (InfoBarController* controller in infobarControllers_.get()) | 177 for (InfoBarController* controller in infobarControllers_.get()) |
178 height += NSHeight([[controller view] frame]); | 178 height += NSHeight([[controller view] frame]); |
179 return height; | 179 return height; |
180 } | 180 } |
181 | 181 |
182 - (void)addInfoBar:(InfoBarDelegate*)delegate animate:(BOOL)animate { | 182 - (void)addInfoBar:(InfoBarDelegate*)delegate animate:(BOOL)animate { |
183 scoped_ptr<InfoBar> infobar(delegate->CreateInfoBar()); | 183 scoped_ptr<InfoBar> infobar(delegate->CreateInfoBar(currentTabContents_)); |
184 InfoBarController* controller = infobar->controller(); | 184 InfoBarController* controller = infobar->controller(); |
185 [controller setContainerController:self]; | 185 [controller setContainerController:self]; |
186 [[controller animatableView] setResizeDelegate:self]; | 186 [[controller animatableView] setResizeDelegate:self]; |
187 [[self view] addSubview:[controller view]]; | 187 [[self view] addSubview:[controller view]]; |
188 [infobarControllers_ addObject:[controller autorelease]]; | 188 [infobarControllers_ addObject:[controller autorelease]]; |
189 | 189 |
190 if (animate) | 190 if (animate) |
191 [controller animateOpen]; | 191 [controller animateOpen]; |
192 else | 192 else |
193 [controller open]; | 193 [controller open]; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 frame.size.width = NSWidth(containerBounds); | 242 frame.size.width = NSWidth(containerBounds); |
243 [view setFrame:frame]; | 243 [view setFrame:frame]; |
244 | 244 |
245 minY += NSHeight(frame); | 245 minY += NSHeight(frame); |
246 } | 246 } |
247 | 247 |
248 [resizeDelegate_ resizeView:[self view] newHeight:[self desiredHeight]]; | 248 [resizeDelegate_ resizeView:[self view] newHeight:[self desiredHeight]]; |
249 } | 249 } |
250 | 250 |
251 @end | 251 @end |
OLD | NEW |