| 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 73d4825261c05a91550c6964a366bce95e9a817d..fea75fa1cfd06cb83114a65bd9809e90a3aabd37 100644
|
| --- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
|
| +++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
|
| @@ -1466,12 +1466,17 @@ void AutofillDialogControllerImpl::EditClickedForSection(
|
| gfx::Image AutofillDialogControllerImpl::IconForField(
|
| ServerFieldType type, const string16& user_input) const {
|
| ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
|
| - if (type == CREDIT_CARD_VERIFICATION_CODE)
|
| + const std::string credit_card_type =
|
| + CreditCard::GetCreditCardType(user_input);
|
| +
|
| + if (type == CREDIT_CARD_VERIFICATION_CODE) {
|
| + if (credit_card_type == autofill::kAmericanExpressCard)
|
| + return rb.GetImageNamed(IDR_CREDIT_CARD_CVC_HINT_AMEX);
|
| return rb.GetImageNamed(IDR_CREDIT_CARD_CVC_HINT);
|
| + }
|
|
|
| if (type == CREDIT_CARD_NUMBER) {
|
| - const int input_card_idr = CreditCard::IconResourceId(
|
| - CreditCard::GetCreditCardType(user_input));
|
| + const int input_card_idr = CreditCard::IconResourceId(credit_card_type);
|
| if (input_card_idr != IDR_AUTOFILL_CC_GENERIC)
|
| return rb.GetImageNamed(input_card_idr);
|
|
|
| @@ -1486,6 +1491,30 @@ gfx::Image AutofillDialogControllerImpl::IconForField(
|
| return gfx::Image();
|
| }
|
|
|
| +bool AutofillDialogControllerImpl::IsIconDependentField(
|
| + ServerFieldType dependent_type) const {
|
| + for (std::map<ServerFieldType, ServerFieldType>::const_iterator iter =
|
| + icon_dependencies_.begin();
|
| + iter != icon_dependencies_.end();
|
| + ++iter) {
|
| + if (iter->second == dependent_type)
|
| + return true;
|
| + }
|
| + return false;
|
| +}
|
| +
|
| +bool AutofillDialogControllerImpl::IsIconDependencyField(
|
| + ServerFieldType dependency_type,
|
| + ServerFieldType* dependent_type) const {
|
| + std::map<ServerFieldType, ServerFieldType>::const_iterator dependency_iter =
|
| + icon_dependencies_.find(dependency_type);
|
| + if (dependency_iter == icon_dependencies_.end())
|
| + return false;
|
| + if (dependent_type)
|
| + *dependent_type = dependency_iter->second;
|
| + return true;
|
| +}
|
| +
|
| // TODO(estade): Replace all the error messages here with more helpful and
|
| // translateable ones. TODO(groby): Also add tests.
|
| string16 AutofillDialogControllerImpl::InputValidityMessage(
|
| @@ -2298,6 +2327,7 @@ AutofillDialogControllerImpl::AutofillDialogControllerImpl(
|
| was_ui_latency_logged_(false) {
|
| // TODO(estade): remove duplicates from |form_structure|?
|
| DCHECK(!callback_.is_null());
|
| + icon_dependencies_[CREDIT_CARD_NUMBER] = CREDIT_CARD_VERIFICATION_CODE;
|
| }
|
|
|
| AutofillDialogView* AutofillDialogControllerImpl::CreateView() {
|
|
|