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

Unified Diff: chrome/browser/ui/autofill/chrome_autofill_client.cc

Issue 710453002: [Autofill] Componentize AutofillCCInfoBarDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove infobar if its associated page content is destroyed. Created 5 years, 12 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/ui/autofill/chrome_autofill_client.cc
diff --git a/chrome/browser/ui/autofill/chrome_autofill_client.cc b/chrome/browser/ui/autofill/chrome_autofill_client.cc
index 882e989bda4eda6d4d8c74936b095ce22ea963e0..aea0036bec1faf224b0c445cc51803e489913710 100644
--- a/chrome/browser/ui/autofill/chrome_autofill_client.cc
+++ b/chrome/browser/ui/autofill/chrome_autofill_client.cc
@@ -6,7 +6,6 @@
#include "base/logging.h"
#include "base/prefs/pref_service.h"
-#include "chrome/browser/autofill/autofill_cc_infobar_delegate.h"
#include "chrome/browser/autofill/personal_data_manager_factory.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/password_manager/chrome_password_manager_client.h"
@@ -23,7 +22,9 @@
#include "chrome/browser/webdata/web_data_service_factory.h"
#include "chrome/common/url_constants.h"
#include "components/autofill/content/browser/content_autofill_driver.h"
+#include "components/autofill/content/browser/content_autofill_driver_factory.h"
#include "components/autofill/content/common/autofill_messages.h"
+#include "components/autofill/core/browser/autofill_cc_infobar_delegate.h"
#include "components/autofill/core/common/autofill_pref_names.h"
#include "components/password_manager/content/browser/content_password_manager_driver.h"
#include "content/public/browser/render_view_host.h"
@@ -137,10 +138,11 @@ void ChromeAutofillClient::OnVerificationFailure() {
}
void ChromeAutofillClient::ConfirmSaveCreditCard(
+ AutofillDriver* autofill_driver,
const base::Closure& save_card_callback) {
- InfoBarService* infobar_service =
- InfoBarService::FromWebContents(web_contents());
- AutofillCCInfoBarDelegate::Create(infobar_service, save_card_callback);
+ AutofillCCInfoBarDelegate::Create(
+ InfoBarService::FromWebContents(web_contents()), autofill_driver,
+ save_card_callback);
}
bool ChromeAutofillClient::HasCreditCardScanFeature() {
@@ -225,6 +227,20 @@ void ChromeAutofillClient::WebContentsDestroyed() {
HideAutofillPopup();
}
+void ChromeAutofillClient::RenderFrameDeleted(
+ content::RenderFrameHost* render_frame) {
+ ContentAutofillDriverFactory* autofill_driver_factory =
+ ContentAutofillDriverFactory::FromWebContents(web_contents());
+ autofill::AutofillDriver* driver =
+ autofill_driver_factory->DriverForFrame(render_frame);
+ if (driver != nullptr) {
+ autofill::AutofillCCInfoBarDelegate* cc_infobar_delegate =
+ AutofillCCInfoBarDelegate::FromAutofillDriver(driver);
+ if (cc_infobar_delegate != nullptr)
+ cc_infobar_delegate->CloseInfoBar();
+ }
+}
+
void ChromeAutofillClient::OnZoomChanged(
const ui_zoom::ZoomController::ZoomChangedEventData& data) {
HideAutofillPopup();

Powered by Google App Engine
This is Rietveld 408576698