Chromium Code Reviews

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

Issue 174349: Add support for replace infobar. The lack of this was a top mac crasher.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « chrome/browser/cocoa/infobar_container_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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];
« no previous file with comments | « chrome/browser/cocoa/infobar_container_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine