Chromium Code Reviews| Index: chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm |
| =================================================================== |
| --- chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm (revision 87366) |
| +++ chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm (working copy) |
| @@ -30,23 +30,28 @@ |
| const NotificationDetails& details) { |
| switch (type.value) { |
| case NotificationType::TAB_CONTENTS_INFOBAR_ADDED: |
| - [controller_ addInfoBar:Details<InfoBarDelegate>(details).ptr() |
| + [controller_ addInfoBar:Details<InfoBar>(details).ptr() |
| animate:YES]; |
| break; |
| - case NotificationType::TAB_CONTENTS_INFOBAR_REMOVED: |
| + |
| + case NotificationType::TAB_CONTENTS_INFOBAR_REMOVED: { |
| + typedef std::pair<InfoBarDelegate*, bool> RemoveDetails; |
| + RemoveDetails* remove_details = Details<RemoveDetails>(details).ptr(); |
| [controller_ |
| - closeInfoBarsForDelegate:Details<InfoBarDelegate>(details).ptr() |
| - animate:YES]; |
| + closeInfoBarsForDelegate:remove_details->first |
| + animate:(remove_details->second ? YES : NO)]; |
| 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]; |
| + typedef std::pair<InfoBarDelegate*, InfoBar*> ReplaceDetails; |
| + ReplaceDetails* replace_details = |
| + Details<ReplaceDetails>(details).ptr(); |
| + [controller_ replaceInfoBarsForDelegate:replace_details->first |
| + with:replace_details->second]; |
| break; |
| } |
| + |
| default: |
| NOTREACHED(); // we don't ask for anything else! |
| break; |
| @@ -127,11 +132,12 @@ |
| currentTabContents_ = contents; |
| if (currentTabContents_) { |
| for (size_t i = 0; i < currentTabContents_->infobar_count(); ++i) { |
| - [self addInfoBar:currentTabContents_->GetInfoBarDelegateAt(i) |
| - animate:NO]; |
| + InfoBar* infobar = currentTabContents_->GetInfoBarDelegateAt(i)-> |
| + CreateInfoBar(currentTabContents_)); |
|
rohitrao (ping after 24h)
2011/06/01 20:58:41
Extra ) at the end.
|
| + [self addInfoBar:infobar animate:NO]; |
| } |
| - Source<TabContents> source(currentTabContents_->tab_contents()); |
| + Source<TabContentsWrapper> source(currentTabContents_); |
| registrar_.Add(infoBarObserver_.get(), |
| NotificationType::TAB_CONTENTS_INFOBAR_ADDED, source); |
| registrar_.Add(infoBarObserver_.get(), |
| @@ -179,8 +185,8 @@ |
| return height; |
| } |
| -- (void)addInfoBar:(InfoBarDelegate*)delegate animate:(BOOL)animate { |
| - scoped_ptr<InfoBar> infobar(delegate->CreateInfoBar(currentTabContents_)); |
| +- (void)addInfoBar:(InfoBar*)infobar animate:(BOOL)animate { |
| + scoped_ptr<InfoBar> infobar_deleter(infobar); |
| InfoBarController* controller = infobar->controller(); |
| [controller setContainerController:self]; |
| [[controller animatableView] setResizeDelegate:self]; |
| @@ -208,9 +214,9 @@ |
| } |
| - (void)replaceInfoBarsForDelegate:(InfoBarDelegate*)old_delegate |
| - with:(InfoBarDelegate*)new_delegate { |
| + with:(InfoBar*)new_infobar { |
| [self closeInfoBarsForDelegate:old_delegate animate:NO]; |
| - [self addInfoBar:new_delegate animate:NO]; |
| + [self addInfoBar:new_infobar animate:NO]; |
| } |
| - (void)removeAllInfoBars { |