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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/logging.h" // for NOTREACHED() | 7 #include "base/logging.h" // for NOTREACHED() |
8 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "chrome/browser/infobars/infobar_tab_helper.h" | 10 #include "chrome/browser/infobars/infobar_tab_helper.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 replaceSubview:labelPlaceholder_ with:label_.get()]; | 229 replaceSubview:labelPlaceholder_ with:label_.get()]; |
230 labelPlaceholder_ = nil; // Now released. | 230 labelPlaceholder_ = nil; // Now released. |
231 [label_.get() setDelegate:self]; | 231 [label_.get() setDelegate:self]; |
232 } | 232 } |
233 | 233 |
234 - (void)cleanUpAfterAnimation:(BOOL)finished { | 234 - (void)cleanUpAfterAnimation:(BOOL)finished { |
235 // Don't need to do any cleanup if the bar was animating open. | 235 // Don't need to do any cleanup if the bar was animating open. |
236 if (!infoBarClosing_) | 236 if (!infoBarClosing_) |
237 return; | 237 return; |
238 | 238 |
239 // Notify the delegate that the infobar was closed. The delegate will delete | 239 // Notify the delegate that the infobar was closed. |
240 // itself as a result of InfoBarClosed(), so we null out its pointer. | |
241 if (delegate_) { | 240 if (delegate_) { |
242 delegate_->InfoBarClosed(); | 241 delete delegate_; |
243 delegate_ = NULL; | 242 delegate_ = NULL; |
244 } | 243 } |
245 | 244 |
246 // If the animation ran to completion, then we need to remove ourselves from | 245 // If the animation ran to completion, then we need to remove ourselves from |
247 // the container. If the animation was interrupted, then the container will | 246 // the container. If the animation was interrupted, then the container will |
248 // take care of removing us. | 247 // take care of removing us. |
249 // TODO(rohitrao): UGH! This works for now, but should be cleaner. | 248 // TODO(rohitrao): UGH! This works for now, but should be cleaner. |
250 if (finished) | 249 if (finished) |
251 [containerController_ removeController:self]; | 250 [containerController_ removeController:self]; |
252 } | 251 } |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 LinkInfoBarController* controller = | 455 LinkInfoBarController* controller = |
457 [[LinkInfoBarController alloc] initWithDelegate:this owner:owner]; | 456 [[LinkInfoBarController alloc] initWithDelegate:this owner:owner]; |
458 return new InfoBar(controller, this); | 457 return new InfoBar(controller, this); |
459 } | 458 } |
460 | 459 |
461 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) { | 460 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) { |
462 ConfirmInfoBarController* controller = | 461 ConfirmInfoBarController* controller = |
463 [[ConfirmInfoBarController alloc] initWithDelegate:this owner:owner]; | 462 [[ConfirmInfoBarController alloc] initWithDelegate:this owner:owner]; |
464 return new InfoBar(controller, this); | 463 return new InfoBar(controller, this); |
465 } | 464 } |
OLD | NEW |