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..7832229cb64e375a2cddae159b0df54ab04487e6 100644 |
--- a/chrome/browser/infobars/infobar_service.cc |
+++ b/chrome/browser/infobars/infobar_service.cc |
@@ -17,16 +17,6 @@ |
DEFINE_WEB_CONTENTS_USER_DATA_KEY(InfoBarService); |
// static |
-InfoBarManager* InfoBarService::InfoBarManagerFromWebContents( |
- content::WebContents* web_contents) { |
- InfoBarService* infobar_service = FromWebContents(web_contents); |
- // |infobar_service| may be NULL during shutdown. |
- if (!infobar_service) |
- return NULL; |
- return infobar_service->infobar_manager(); |
-} |
- |
-// static |
InfoBarDelegate::NavigationDetails |
InfoBarService::NavigationDetailsFromLoadCommittedDetails( |
const content::LoadCommittedDetails& details) { |
@@ -47,36 +37,60 @@ 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() { |
+ ShutDown(); |
} |
-InfoBarService::InfoBarService(content::WebContents* web_contents) |
- : content::WebContentsObserver(web_contents), |
- infobar_manager_(web_contents) { |
- DCHECK(web_contents); |
- infobar_manager_.AddObserver(this); |
+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() {} |
+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)); |
+} |
+ |
+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( |
- NavigationDetailsFromLoadCommittedDetails(load_details)); |
+ 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 +112,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); |