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

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

Issue 228293004: InfoBarService inherits from InfoBarManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor changes 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
Index: chrome/browser/infobars/infobar_service.cc
diff --git a/chrome/browser/infobars/infobar_service.cc b/chrome/browser/infobars/infobar_service.cc
index 8a2983070097b429190f43784c92e728b50976c8..c0ba7ad4bdcc76f22dff5dbccdb825b485d852e5 100644
--- a/chrome/browser/infobars/infobar_service.cc
+++ b/chrome/browser/infobars/infobar_service.cc
@@ -47,36 +47,59 @@ InfoBarDelegate::NavigationDetails
return navigation_details;
}
-InfoBar* InfoBarService::AddInfoBar(scoped_ptr<InfoBar> infobar) {
- return infobar_manager_.AddInfoBar(infobar.Pass());
+InfoBarService::InfoBarService(content::WebContents* web_contents)
+ : InfoBarManager(web_contents),
+ content::WebContentsObserver(web_contents) {
+ DCHECK(web_contents);
}
-InfoBar* InfoBarService::ReplaceInfoBar(InfoBar* old_infobar,
- scoped_ptr<InfoBar> new_infobar) {
- return infobar_manager_.ReplaceInfoBar(old_infobar, new_infobar.Pass());
+InfoBarService::~InfoBarService() {}
+
+void InfoBarService::NotifyInfoBarAdded(InfoBar* infobar) {
+ InfoBarManager::NotifyInfoBarAdded(infobar);
+ // TODO(droger): Remove the notifications and have listeners change to be
+ // NavigationManager::Observers instead. See http://crbug.com/354380
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED,
+ content::Source<InfoBarService>(this),
+ content::Details<InfoBar::AddedDetails>(infobar));
}
-InfoBarService::InfoBarService(content::WebContents* web_contents)
- : content::WebContentsObserver(web_contents),
- infobar_manager_(web_contents) {
- DCHECK(web_contents);
- infobar_manager_.AddObserver(this);
+void InfoBarService::NotifyInfoBarRemoved(InfoBar* infobar, bool animate) {
+ InfoBarManager::NotifyInfoBarRemoved(infobar, animate);
+ // TODO(droger): Remove the notifications and have listeners change to be
+ // NavigationManager::Observers instead. See http://crbug.com/354380
+ InfoBar::RemovedDetails removed_details(infobar, animate);
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED,
+ content::Source<InfoBarService>(this),
+ content::Details<InfoBar::RemovedDetails>(&removed_details));
}
-InfoBarService::~InfoBarService() {}
+void InfoBarService::NotifyInfoBarReplaced(InfoBar* old_infobar,
+ InfoBar* new_infobar) {
+ InfoBarManager::NotifyInfoBarReplaced(old_infobar, new_infobar);
+ // TODO(droger): Remove the notifications and have listeners change to be
+ // NavigationManager::Observers instead. See http://crbug.com/354380
+ InfoBar::ReplacedDetails replaced_details(old_infobar, new_infobar);
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED,
+ content::Source<InfoBarService>(this),
+ content::Details<InfoBar::ReplacedDetails>(&replaced_details));
+}
void InfoBarService::RenderProcessGone(base::TerminationStatus status) {
- infobar_manager_.RemoveAllInfoBars(true);
+ RemoveAllInfoBars(true);
}
void InfoBarService::NavigationEntryCommitted(
const content::LoadCommittedDetails& load_details) {
- infobar_manager_.OnNavigation(
+ OnNavigation(
NavigationDetailsFromLoadCommittedDetails(load_details));
}
void InfoBarService::WebContentsDestroyed(content::WebContents* web_contents) {
- infobar_manager_.OnWebContentsDestroyed();
+ OnWebContentsDestroyed();
// The WebContents is going away; be aggressively paranoid and delete
// ourselves lest other parts of the system attempt to add infobars or use
@@ -98,40 +121,6 @@ bool InfoBarService::OnMessageReceived(const IPC::Message& message) {
return handled;
}
-void InfoBarService::OnInfoBarAdded(InfoBar* infobar) {
- // TODO(droger): Remove the notifications and have listeners change to be
- // NavigationManager::Observers instead. See http://crbug.com/354380
- content::NotificationService::current()->Notify(
- chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED,
- content::Source<InfoBarService>(this),
- content::Details<InfoBar::AddedDetails>(infobar));
-}
-
-void InfoBarService::OnInfoBarReplaced(InfoBar* old_infobar,
- InfoBar* new_infobar) {
- // TODO(droger): Remove the notifications and have listeners change to be
- // NavigationManager::Observers instead. See http://crbug.com/354380
- InfoBar::ReplacedDetails replaced_details(old_infobar, new_infobar);
- content::NotificationService::current()->Notify(
- chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED,
- content::Source<InfoBarService>(this),
- content::Details<InfoBar::ReplacedDetails>(&replaced_details));
-}
-
-void InfoBarService::OnInfoBarRemoved(InfoBar* infobar, bool animate) {
- // TODO(droger): Remove the notifications and have listeners change to be
- // NavigationManager::Observers instead. See http://crbug.com/354380
- InfoBar::RemovedDetails removed_details(infobar, animate);
- content::NotificationService::current()->Notify(
- chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED,
- content::Source<InfoBarService>(this),
- content::Details<InfoBar::RemovedDetails>(&removed_details));
-}
-
-void InfoBarService::OnManagerShuttingDown(InfoBarManager* manager) {
- infobar_manager_.RemoveObserver(this);
-}
-
void InfoBarService::OnDidBlockDisplayingInsecureContent() {
InsecureContentInfoBarDelegate::Create(
this, InsecureContentInfoBarDelegate::DISPLAY);
« chrome/browser/infobars/infobar_service.h ('K') | « chrome/browser/infobars/infobar_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698