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

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

Issue 232353003: Boldly refuse to show rAc dialog if cc info is not requested. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update browsertest Created 6 years, 8 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/autofill_dialog_controller_impl.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
index aa721a01f69f507aff4ad677c7a78728d1604aa3..67997c68ccc801cd4f9f62035ea6aaac5fbb1ca7 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
@@ -661,6 +661,27 @@ void AutofillDialogControllerImpl::Show() {
return;
}
+ // Fail if the author didn't ask for at least some kind of credit card
+ // information.
+ bool has_credit_card_field = false;
+ for (size_t i = 0; i < form_structure_.field_count(); ++i) {
+ AutofillType type = form_structure_.field(i)->Type();
+ if (type.html_type() != HTML_TYPE_UNKNOWN && type.group() == CREDIT_CARD) {
+ has_credit_card_field = true;
+ break;
+ }
+ }
+
+ if (!has_credit_card_field) {
+ callback_.Run(
+ AutofillManagerDelegate::AutocompleteResultErrorUnsupported,
+ base::ASCIIToUTF16("Form is not a payment form (must contain "
+ "some autocomplete=\"cc-*\" fields). "),
+ NULL);
+ delete this;
+ return;
+ }
+
billing_country_combobox_model_.reset(new CountryComboboxModel(
*GetManager(),
base::Bind(CountryFilter,
@@ -730,8 +751,6 @@ void AutofillDialogControllerImpl::Show() {
GetValidator()->LoadRules(
GetManager()->GetDefaultCountryCodeForNewAddress());
- // TODO(estade): don't show the dialog if the site didn't specify the right
- // fields. First we must figure out what the "right" fields are.
SuggestionsUpdated();
SubmitButtonDelayBegin();
view_.reset(CreateView());

Powered by Google App Engine
This is Rietveld 408576698