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

Unified Diff: chrome/browser/tab_contents/tab_contents.cc

Issue 165029: Fix a few bugs with the theme infobar: (Closed)
Patch Set: Created 11 years, 4 months 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/tab_contents/tab_contents.cc
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 5b816f19cac031aa2d5200a6ef4a9df1e6695121..5f6de7ce16ecb4799d654fc531bf526e945bb7de 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -890,6 +890,28 @@ void TabContents::RemoveInfoBar(InfoBarDelegate* delegate) {
}
}
+void TabContents::ReplaceInfoBar(InfoBarDelegate* old_delegate,
+ InfoBarDelegate* new_delegate) {
+ std::vector<InfoBarDelegate*>::iterator it =
+ find(infobar_delegates_.begin(), infobar_delegates_.end(), old_delegate);
+ DCHECK(it != infobar_delegates_.end());
+
+ // Notify the container about the change of plans.
+ scoped_ptr<std::pair<InfoBarDelegate*, InfoBarDelegate*> > details(
+ new std::pair<InfoBarDelegate*, InfoBarDelegate*>(
+ old_delegate, new_delegate));
+ NotificationService::current()->Notify(
+ NotificationType::TAB_CONTENTS_INFOBAR_REPLACED,
+ Source<TabContents>(this),
+ Details<std::pair<InfoBarDelegate*, InfoBarDelegate*> >(details.get()));
+
+ // Remove the old one.
+ infobar_delegates_.erase(it);
+
+ // Add the new one.
+ infobar_delegates_.push_back(new_delegate);
+}
+
bool TabContents::IsBookmarkBarAlwaysVisible() {
// See GetDOMUIForCurrentState() comment for more info. This case is very
// similar, but for non-first loads, we want to use the committed entry. This

Powered by Google App Engine
This is Rietveld 408576698