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

Side by Side 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: relative 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" 5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 // Fail if the author didn't specify autocomplete types. 655 // Fail if the author didn't specify autocomplete types.
656 if (!has_types) { 656 if (!has_types) {
657 callback_.Run( 657 callback_.Run(
658 AutofillManagerDelegate::AutocompleteResultErrorUnsupported, 658 AutofillManagerDelegate::AutocompleteResultErrorUnsupported,
659 base::ASCIIToUTF16("Form is missing autocomplete attributes."), 659 base::ASCIIToUTF16("Form is missing autocomplete attributes."),
660 NULL); 660 NULL);
661 delete this; 661 delete this;
662 return; 662 return;
663 } 663 }
664 664
665 // Fail if the author didn't ask for at least some kind of credit card
666 // information.
667 bool has_credit_card_field = false;
668 for (size_t i = 0; i < form_structure_.field_count(); ++i) {
669 AutofillType type = form_structure_.field(i)->Type();
670 if (type.html_type() != HTML_TYPE_UNKNOWN && type.group() == CREDIT_CARD) {
671 has_credit_card_field = true;
672 break;
673 }
674 }
675
676 if (!has_credit_card_field) {
677 callback_.Run(
678 AutofillManagerDelegate::AutocompleteResultErrorUnsupported,
679 base::ASCIIToUTF16("Form is not a payment form (must contain "
680 "some autocomplete=\"cc-*\" fields). "),
681 NULL);
682 delete this;
683 return;
684 }
685
665 billing_country_combobox_model_.reset(new CountryComboboxModel( 686 billing_country_combobox_model_.reset(new CountryComboboxModel(
666 *GetManager(), 687 *GetManager(),
667 base::Bind(CountryFilter, 688 base::Bind(CountryFilter,
668 form_structure_.PossibleValues(ADDRESS_BILLING_COUNTRY)))); 689 form_structure_.PossibleValues(ADDRESS_BILLING_COUNTRY))));
669 shipping_country_combobox_model_.reset(new CountryComboboxModel( 690 shipping_country_combobox_model_.reset(new CountryComboboxModel(
670 *GetManager(), 691 *GetManager(),
671 base::Bind(CountryFilter, 692 base::Bind(CountryFilter,
672 form_structure_.PossibleValues(ADDRESS_HOME_COUNTRY)))); 693 form_structure_.PossibleValues(ADDRESS_HOME_COUNTRY))));
673 694
674 // Log any relevant UI metrics and security exceptions. 695 // Log any relevant UI metrics and security exceptions.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 743
723 scoped_ptr< ::i18n::addressinput::Downloader> downloader( 744 scoped_ptr< ::i18n::addressinput::Downloader> downloader(
724 new autofill::ChromeDownloaderImpl(profile_->GetRequestContext())); 745 new autofill::ChromeDownloaderImpl(profile_->GetRequestContext()));
725 validator_ = AddressValidator::Build( 746 validator_ = AddressValidator::Build(
726 downloader.Pass(), 747 downloader.Pass(),
727 ValidationRulesStorageFactory::CreateStorage(), 748 ValidationRulesStorageFactory::CreateStorage(),
728 this); 749 this);
729 GetValidator()->LoadRules( 750 GetValidator()->LoadRules(
730 GetManager()->GetDefaultCountryCodeForNewAddress()); 751 GetManager()->GetDefaultCountryCodeForNewAddress());
731 752
732 // TODO(estade): don't show the dialog if the site didn't specify the right
733 // fields. First we must figure out what the "right" fields are.
734 SuggestionsUpdated(); 753 SuggestionsUpdated();
735 SubmitButtonDelayBegin(); 754 SubmitButtonDelayBegin();
736 view_.reset(CreateView()); 755 view_.reset(CreateView());
737 view_->Show(); 756 view_->Show();
738 GetManager()->AddObserver(this); 757 GetManager()->AddObserver(this);
739 758
740 if (!account_chooser_model_->WalletIsSelected()) 759 if (!account_chooser_model_->WalletIsSelected())
741 LogDialogLatencyToShow(); 760 LogDialogLatencyToShow();
742 } 761 }
743 762
(...skipping 3211 matching lines...) Expand 10 before | Expand all | Expand 10 after
3955 view_->UpdateButtonStrip(); 3974 view_->UpdateButtonStrip();
3956 } 3975 }
3957 3976
3958 void AutofillDialogControllerImpl::FetchWalletCookie() { 3977 void AutofillDialogControllerImpl::FetchWalletCookie() {
3959 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); 3978 net::URLRequestContextGetter* request_context = profile_->GetRequestContext();
3960 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); 3979 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context));
3961 signin_helper_->StartWalletCookieValueFetch(); 3980 signin_helper_->StartWalletCookieValueFetch();
3962 } 3981 }
3963 3982
3964 } // namespace autofill 3983 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698