| 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);
|
|
|