Index: chrome/browser/cocoa/infobar_container_controller.mm |
=================================================================== |
--- chrome/browser/cocoa/infobar_container_controller.mm (revision 24114) |
+++ chrome/browser/cocoa/infobar_container_controller.mm (working copy) |
@@ -33,6 +33,15 @@ |
[controller_ |
removeInfoBarsForDelegate:Details<InfoBarDelegate>(details).ptr()]; |
break; |
+ case NotificationType::TAB_CONTENTS_INFOBAR_REPLACED: { |
+ typedef std::pair<InfoBarDelegate*, InfoBarDelegate*> |
+ InfoBarDelegatePair; |
+ InfoBarDelegatePair* delegates = |
+ Details<InfoBarDelegatePair>(details).ptr(); |
+ [controller_ |
+ replaceInfoBarsForDelegate:delegates->first with:delegates->second]; |
+ break; |
+ } |
default: |
NOTREACHED(); // we don't ask for anything else! |
break; |
@@ -130,6 +139,8 @@ |
NotificationType::TAB_CONTENTS_INFOBAR_ADDED, source); |
registrar_.Add(infoBarObserver_.get(), |
NotificationType::TAB_CONTENTS_INFOBAR_REMOVED, source); |
+ registrar_.Add(infoBarObserver_.get(), |
+ NotificationType::TAB_CONTENTS_INFOBAR_REPLACED, source); |
} |
[self positionInfoBarsAndRedraw]; |
@@ -145,7 +156,7 @@ |
- (void)removeInfoBarsForDelegate:(InfoBarDelegate*)delegate { |
for (InfoBarController* controller in |
- [NSArray arrayWithArray:infobarControllers_.get()]) { |
+ [NSArray arrayWithArray:infobarControllers_.get()]) { |
if ([controller delegate] == delegate) { |
// This code can be executed while -[InfoBarController closeInfoBar] is |
// still on the stack, so we retain and autorelease the controller to |
@@ -157,6 +168,13 @@ |
} |
} |
+- (void)replaceInfoBarsForDelegate:(InfoBarDelegate*)old_delegate |
+ with:(InfoBarDelegate*)new_delegate { |
+ // TODO(port): This should avoid animation when we add it. |
Aaron Boodman
2009/08/24 21:29:07
Cool, thanks for adding this TODO
rohitrao (ping after 24h)
2009/08/25 15:57:35
Feel free to assign this TODO to me.
|
+ [self removeInfoBarsForDelegate:old_delegate]; |
+ [self addInfoBar:new_delegate]; |
+} |
+ |
- (void)removeAllInfoBars { |
for (InfoBarController* controller in infobarControllers_.get()) { |
[[controller view] removeFromSuperview]; |