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

Unified Diff: chrome/browser/infobars/infobar_manager.cc

Issue 228293004: InfoBarService inherits from InfoBarManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 6 years, 8 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
« no previous file with comments | « chrome/browser/infobars/infobar_manager.h ('k') | chrome/browser/infobars/infobar_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/infobars/infobar_manager.cc
diff --git a/chrome/browser/infobars/infobar_manager.cc b/chrome/browser/infobars/infobar_manager.cc
index 4e3bcb6784e6556ee83e0f2e673a49be6b45b358..ce2cb6c2160f14e7687864e087e64fe98e63f26a 100644
--- a/chrome/browser/infobars/infobar_manager.cc
+++ b/chrome/browser/infobars/infobar_manager.cc
@@ -25,7 +25,7 @@ InfoBar* InfoBarManager::AddInfoBar(scoped_ptr<InfoBar> infobar) {
infobars_.push_back(infobar_ptr);
infobar_ptr->SetOwner(this);
- FOR_EACH_OBSERVER(Observer, observer_list_, OnInfoBarAdded(infobar_ptr));
+ NotifyInfoBarAdded(infobar_ptr);
return infobar_ptr;
}
@@ -58,9 +58,7 @@ InfoBar* InfoBarManager::ReplaceInfoBar(InfoBar* old_infobar,
// to AddInfoBar() or similar, we don't dupe-check against this infobar.
infobars_.erase(++i);
- FOR_EACH_OBSERVER(Observer,
- observer_list_,
- OnInfoBarReplaced(old_infobar, new_infobar_ptr));
+ NotifyInfoBarReplaced(old_infobar, new_infobar_ptr);
old_infobar->CloseSoon();
return new_infobar_ptr;
@@ -74,15 +72,15 @@ void InfoBarManager::RemoveObserver(Observer* obs) {
observer_list_.RemoveObserver(obs);
}
-InfoBarManager::InfoBarManager(content::WebContents* web_contents)
- : infobars_enabled_(true),
- web_contents_(web_contents) {
- DCHECK(web_contents);
+InfoBarManager::InfoBarManager()
+ : infobars_enabled_(true) {
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableInfoBars))
infobars_enabled_ = false;
}
-InfoBarManager::~InfoBarManager() {
+InfoBarManager::~InfoBarManager() {}
+
+void InfoBarManager::ShutDown() {
// Destroy all remaining InfoBars. It's important to not animate here so that
// we guarantee that we'll delete all delegates before we do anything else.
RemoveAllInfoBars(false);
@@ -101,7 +99,21 @@ void InfoBarManager::OnNavigation(
}
}
-void InfoBarManager::OnWebContentsDestroyed() { web_contents_ = NULL; }
+void InfoBarManager::NotifyInfoBarAdded(InfoBar* infobar) {
+ FOR_EACH_OBSERVER(Observer, observer_list_, OnInfoBarAdded(infobar));
+}
+
+void InfoBarManager::NotifyInfoBarRemoved(InfoBar* infobar, bool animate) {
+ FOR_EACH_OBSERVER(Observer, observer_list_,
+ OnInfoBarRemoved(infobar, animate));
+}
+
+void InfoBarManager::NotifyInfoBarReplaced(InfoBar* old_infobar,
+ InfoBar* new_infobar) {
+ FOR_EACH_OBSERVER(Observer,
+ observer_list_,
+ OnInfoBarReplaced(old_infobar, new_infobar));
+}
void InfoBarManager::RemoveInfoBarInternal(InfoBar* infobar, bool animate) {
DCHECK(infobar);
@@ -119,8 +131,7 @@ void InfoBarManager::RemoveInfoBarInternal(InfoBar* infobar, bool animate) {
// This notification must happen before the call to CloseSoon() below, since
// observers may want to access |infobar| and that call can delete it.
- FOR_EACH_OBSERVER(Observer, observer_list_,
- OnInfoBarRemoved(infobar, animate));
+ NotifyInfoBarRemoved(infobar, animate);
infobar->CloseSoon();
}
« no previous file with comments | « chrome/browser/infobars/infobar_manager.h ('k') | chrome/browser/infobars/infobar_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698