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

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

Issue 7006010: Change InfoBar-related notifications to be sourced from a TabContentsWrapper, not a TabContents. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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/ui/tab_contents/tab_contents_wrapper.cc
===================================================================
--- chrome/browser/ui/tab_contents/tab_contents_wrapper.cc (revision 87541)
+++ chrome/browser/ui/tab_contents/tab_contents_wrapper.cc (working copy)
@@ -461,8 +461,8 @@
infobar_delegates_.push_back(delegate);
NotificationService::current()->Notify(
NotificationType::TAB_CONTENTS_INFOBAR_ADDED,
- Source<TabContents>(tab_contents_.get()),
- Details<InfoBarDelegate>(delegate));
+ Source<TabContentsWrapper>(this),
+ Details<InfoBar>(delegate->CreateInfoBar(this)));
// Add ourselves as an observer for navigations the first time a delegate is
// added. We use this notification to expire InfoBars that need to expire on
@@ -480,11 +480,12 @@
std::vector<InfoBarDelegate*>::iterator it =
find(infobar_delegates_.begin(), infobar_delegates_.end(), delegate);
if (it != infobar_delegates_.end()) {
- InfoBarDelegate* delegate = *it;
+ typedef std::pair<InfoBarDelegate*, bool> RemoveDetails;
+ RemoveDetails remove_details(*it, true);
NotificationService::current()->Notify(
NotificationType::TAB_CONTENTS_INFOBAR_REMOVED,
- Source<TabContents>(tab_contents_.get()),
- Details<InfoBarDelegate>(delegate));
+ Source<TabContentsWrapper>(this),
+ Details<RemoveDetails>(&remove_details));
infobar_delegates_.erase(it);
// Remove ourselves as an observer if we are tracking no more InfoBars.
@@ -508,13 +509,13 @@
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));
+ typedef std::pair<InfoBarDelegate*, InfoBar*> ReplaceDetails;
+ ReplaceDetails replace_details(old_delegate,
+ new_delegate->CreateInfoBar(this));
NotificationService::current()->Notify(
NotificationType::TAB_CONTENTS_INFOBAR_REPLACED,
- Source<TabContents>(tab_contents_.get()),
- Details<std::pair<InfoBarDelegate*, InfoBarDelegate*> >(details.get()));
+ Source<TabContentsWrapper>(this),
+ Details<ReplaceDetails>(&replace_details));
// Remove the old one.
infobar_delegates_.erase(it);
« no previous file with comments | « chrome/browser/ui/gtk/infobars/infobar_container_gtk.cc ('k') | chrome/browser/ui/views/infobars/after_translate_infobar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698