diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-01 18:56:21 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-01 18:56:21 +0000 |
commit | 7e2041201c0de2336b80f5afb9e7bebeda6be68e (patch) | |
tree | bfda35d9f7b84ec7347baa35b18551bfae967967 /chrome/browser/automation/automation_provider_observers.cc | |
parent | fed17d435c43ab7ef492664196ec4535b3a48af5 (diff) | |
download | chromium_src-7e2041201c0de2336b80f5afb9e7bebeda6be68e.zip chromium_src-7e2041201c0de2336b80f5afb9e7bebeda6be68e.tar.gz chromium_src-7e2041201c0de2336b80f5afb9e7bebeda6be68e.tar.bz2 |
Move infobar handling to a tab helper, part 1.
Revert revert of r99187.
This reverts r99198.
BUG=94741
TEST=no visible change
Review URL: http://codereview.chromium.org/7810002
TBR=avi@chromium.org
Review URL: http://codereview.chromium.org/7827017
Review URL: http://codereview.chromium.org/7826014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99222 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation/automation_provider_observers.cc')
-rw-r--r-- | chrome/browser/automation/automation_provider_observers.cc | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index 0679c97..8de225a 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -33,6 +33,7 @@ #include "chrome/browser/extensions/extension_updater.h" #include "chrome/browser/history/history_types.h" #include "chrome/browser/history/top_sites.h" +#include "chrome/browser/infobars/infobar_tab_helper.h" #include "chrome/browser/metrics/metric_event_duration_details.h" #include "chrome/browser/notifications/balloon.h" #include "chrome/browser/notifications/balloon_collection.h" @@ -1372,7 +1373,7 @@ void InfoBarCountObserver::Observe(int type, } void InfoBarCountObserver::CheckCount() { - if (tab_contents_->infobar_count() != target_count_) + if (tab_contents_->infobar_tab_helper()->infobar_count() != target_count_) return; if (automation_) { @@ -2288,10 +2289,11 @@ AutofillFormSubmittedObserver::~AutofillFormSubmittedObserver() { pdm_->RemoveObserver(this); if (tab_contents_) { + InfoBarTabHelper* infobar_helper = tab_contents_->infobar_tab_helper(); InfoBarDelegate* infobar = NULL; - if (tab_contents_->infobar_count() > 0 && - (infobar = tab_contents_->GetInfoBarDelegateAt(0))) { - tab_contents_->RemoveInfoBar(infobar); + if (infobar_helper->infobar_count() > 0 && + (infobar = infobar_helper->GetInfoBarDelegateAt(0))) { + infobar_helper->RemoveInfoBar(infobar); } } } @@ -2317,20 +2319,14 @@ void AutofillFormSubmittedObserver::Observe( const NotificationSource& source, const NotificationDetails& details) { DCHECK(type == chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED); + // Accept in the infobar. tab_contents_ = Source<TabContentsWrapper>(source).ptr(); InfoBarDelegate* infobar = NULL; - if (!(infobar = tab_contents_->GetInfoBarDelegateAt(0))) { - if (automation_) { - AutomationJSONReply( - automation_, reply_message_.release()).SendError( - "Could not identify the infobar delegate."); - } - delete this; - return; - } - ConfirmInfoBarDelegate* confirm_infobar; - if (!(confirm_infobar = infobar->AsConfirmInfoBarDelegate())) { + infobar = tab_contents_->infobar_tab_helper()->GetInfoBarDelegateAt(0); + + ConfirmInfoBarDelegate* confirm_infobar = infobar->AsConfirmInfoBarDelegate(); + if (!confirm_infobar) { if (automation_) { AutomationJSONReply( automation_, reply_message_.release()).SendError( @@ -2339,7 +2335,8 @@ void AutofillFormSubmittedObserver::Observe( delete this; return; } - if (!(confirm_infobar->Accept())) { + + if (!confirm_infobar->Accept()) { if (automation_) { AutomationJSONReply( automation_, reply_message_.release()).SendError( |