| Index: chrome/browser/autofill/autofill_manager.cc
|
| diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc
|
| index 5c49249fff797051d45d81aa95376948c6c9ea3d..c54d910906a541503a9d0de897e46d0e420344e7 100644
|
| --- a/chrome/browser/autofill/autofill_manager.cc
|
| +++ b/chrome/browser/autofill/autofill_manager.cc
|
| @@ -244,6 +244,9 @@ bool AutoFillManager::FillAutoFillFormData(int query_id,
|
| autofill_type.group() == AutoFillType::CREDIT_CARD) {
|
| result.fields[i].set_value(
|
| credit_card->GetFieldText(autofill_type));
|
| + } else if (credit_card &&
|
| + autofill_type.group() == AutoFillType::ADDRESS_BILLING) {
|
| + FillBillingFormField(credit_card, autofill_type, &result.fields[i]);
|
| } else if (profile) {
|
| FillFormField(profile, autofill_type, &result.fields[i]);
|
| }
|
| @@ -466,6 +469,31 @@ void AutoFillManager::GetCreditCardSuggestions(const FormField& field,
|
| }
|
| }
|
|
|
| +void AutoFillManager::FillBillingFormField(const CreditCard* credit_card,
|
| + AutoFillType type,
|
| + webkit_glue::FormField* field) {
|
| + DCHECK(credit_card);
|
| + DCHECK(type.group() == AutoFillType::ADDRESS_BILLING);
|
| + DCHECK(field);
|
| +
|
| + string16 billing_address = credit_card->billing_address();
|
| + if (!billing_address.empty()) {
|
| + AutoFillProfile* profile = NULL;
|
| + const std::vector<AutoFillProfile*>& profiles = personal_data_->profiles();
|
| + for (std::vector<AutoFillProfile*>::const_iterator iter = profiles.begin();
|
| + iter != profiles.end(); ++iter) {
|
| + if ((*iter)->Label() == billing_address) {
|
| + profile = *iter;
|
| + break;
|
| + }
|
| + }
|
| +
|
| + if (profile) {
|
| + FillFormField(profile, type, field);
|
| + }
|
| + }
|
| +}
|
| +
|
| void AutoFillManager::FillFormField(const AutoFillProfile* profile,
|
| AutoFillType type,
|
| webkit_glue::FormField* field) {
|
|
|