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

Unified Diff: chrome/browser/automation/automation_provider_observers.cc

Issue 7810002: Move infobar handling to a tab helper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 9 years, 4 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/automation/automation_provider_observers.cc
diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc
index 0679c97560bfa1711d5f97d464c616e42c1cfeeb..8de225a96d838b01b76c1c349f21a39c72df2ba0 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(
« no previous file with comments | « chrome/browser/autofill/autofill_manager.cc ('k') | chrome/browser/automation/testing_automation_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698