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

Unified Diff: chrome/browser/cocoa/infobar_controller.mm

Issue 4767001: Make TabContents own its infobar delegates.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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/cocoa/infobar_controller.mm
===================================================================
--- chrome/browser/cocoa/infobar_controller.mm (revision 65711)
+++ chrome/browser/cocoa/infobar_controller.mm (working copy)
@@ -176,6 +176,8 @@
}
- (void)close {
+ delegate_ = NULL;
+
// Stop any running animations.
[[self animatableView] stopAnimation];
infoBarClosing_ = YES;
@@ -183,9 +185,10 @@
}
- (void)animateClosed {
+ delegate_ = NULL;
+
// Start animating closed. We will receive a notification when the animation
- // is done, at which point we can remove our view from the hierarchy and
- // notify the delegate that the infobar was closed.
+ // is done, at which point we can remove our view from the hierarchy.
[[self animatableView] animateToNewHeight:0 duration:kAnimateCloseDuration];
// The above call may trigger an animationDidStop: notification for any
@@ -248,7 +251,8 @@
// been removed and |delegate_| is NULL. Is there a way to rewrite the code
// so that inner event loops don't cause us to try and remove the infobar
// twice? http://crbug.com/54253
- [containerController_ removeDelegate:delegate_];
+ if (delegate_ != NULL)
+ [containerController_ removeDelegate:delegate_];
}
- (void)cleanUpAfterAnimation:(BOOL)finished {
@@ -256,13 +260,6 @@
if (!infoBarClosing_)
return;
- // Notify the delegate that the infobar was closed. The delegate may delete
- // itself as a result of InfoBarClosed(), so we null out its pointer.
- if (delegate_) {
- delegate_->InfoBarClosed();
- delegate_ = NULL;
- }
-
// If the animation ran to completion, then we need to remove ourselves from
// the container. If the animation was interrupted, then the container will
// take care of removing us.

Powered by Google App Engine
This is Rietveld 408576698