Chromium Code Reviews| Index: chrome/browser/ui/autofill/data_model_wrapper.cc |
| diff --git a/chrome/browser/ui/autofill/data_model_wrapper.cc b/chrome/browser/ui/autofill/data_model_wrapper.cc |
| index 727aec75df156a4004e7ba407ff92ddeb6c17f6c..af76751718b93b8789acaee93ff2294233a96eda 100644 |
| --- a/chrome/browser/ui/autofill/data_model_wrapper.cc |
| +++ b/chrome/browser/ui/autofill/data_model_wrapper.cc |
| @@ -8,10 +8,11 @@ |
| #include "base/utf_string_conversions.h" |
| #include "components/autofill/browser/autofill_country.h" |
| #include "components/autofill/browser/autofill_profile.h" |
| +#include "components/autofill/browser/autofill_type.h" |
| #include "components/autofill/browser/credit_card.h" |
| #include "components/autofill/browser/form_group.h" |
| #include "components/autofill/browser/form_structure.h" |
| -#include "components/autofill/browser/wallet/wallet_address.h" |
| +#include "components/autofill/browser/wallet/full_wallet.h" |
| #include "components/autofill/browser/wallet/wallet_address.h" |
| #include "components/autofill/browser/wallet/wallet_items.h" |
| #include "ui/base/resource/resource_bundle.h" |
| @@ -49,6 +50,12 @@ void DataModelWrapper::FillFormStructure( |
| } |
| } |
| +void DataModelWrapper::FillInputs(DetailInputs* inputs) { |
| + for (size_t i = 0; i < inputs->size(); ++i) { |
| + (*inputs)[i].autofilled_value = GetInfo((*inputs)[i].type); |
| + } |
| +} |
| + |
| // AutofillFormGroupWrapper |
| AutofillFormGroupWrapper::AutofillFormGroupWrapper(const FormGroup* form_group, |
| @@ -143,12 +150,6 @@ gfx::Image WalletAddressWrapper::GetIcon() { |
| return gfx::Image(); |
| } |
| -void WalletAddressWrapper::FillInputs(DetailInputs* inputs) { |
| - for (size_t j = 0; j < inputs->size(); ++j) { |
| - (*inputs)[j].autofilled_value = address_->GetInfo((*inputs)[j].type); |
| - } |
| -} |
| - |
| void WalletAddressWrapper::FillFormField(AutofillField* field) { |
| field->value = GetInfo(field->type()); |
| } |
| @@ -169,10 +170,6 @@ gfx::Image WalletInstrumentWrapper::GetIcon() { |
| return instrument_->CardIcon(); |
| } |
| -void WalletInstrumentWrapper::FillInputs(DetailInputs* inputs) { |
| - // TODO(estade): implement. |
| -} |
| - |
| string16 WalletInstrumentWrapper::GetDisplayText() { |
| // TODO(estade): descriptive_name() is user-provided. Should we use it or |
| // just type + last 4 digits? |
| @@ -184,4 +181,52 @@ void WalletInstrumentWrapper::FillFormField(AutofillField* field) { |
| field->value = GetInfo(field->type()); |
| } |
| +// FullWalletWrapper |
| + |
| +FullWalletWrapper::FullWalletWrapper(wallet::FullWallet* full_wallet) |
| + : full_wallet_(full_wallet) { |
| + DCHECK(full_wallet_); |
| +} |
| + |
| +FullWalletWrapper::~FullWalletWrapper() {} |
| + |
| +string16 FullWalletWrapper::GetInfo(AutofillFieldType type) { |
|
Evan Stade
2013/03/14 02:39:38
FullWalletWrapper needn't exist. Implement GetInfo
Dan Beam
2013/03/14 04:31:51
Done.
|
| + return full_wallet_->GetInfo(type, IsBillingWrapper()); |
| +} |
| + |
| +gfx::Image FullWalletWrapper::GetIcon() { |
| + // TODO(dbeam): this could be implemented if necessary, I just don't see where |
|
Evan Stade
2013/03/14 02:39:38
comment too verbose. Remove.
Dan Beam
2013/03/14 04:31:51
Done.
|
| + // we'd ever need it -- this wrapper is only used to fill values into |
| + // |AutofillDialogControllerImlp::form_structure_| at the moment. |
| + return gfx::Image(); |
| +} |
| + |
| +void FullWalletWrapper::FillFormField(AutofillField* field) { |
| + field->value = GetInfo(field->type()); |
| +} |
| + |
| +// FullWalletBillingWrapper |
| + |
| +FullWalletBillingWrapper::FullWalletBillingWrapper( |
| + wallet::FullWallet* full_wallet) |
| + : FullWalletWrapper(full_wallet) {} |
| + |
| +FullWalletBillingWrapper::~FullWalletBillingWrapper() {} |
| + |
| +bool FullWalletBillingWrapper::IsBillingWrapper() const { |
| + return true; |
| +} |
| + |
| +// FullWalletShippingWrapper |
| + |
| +FullWalletShippingWrapper::FullWalletShippingWrapper( |
| + wallet::FullWallet* full_wallet) |
| + : FullWalletWrapper(full_wallet) {} |
| + |
| +FullWalletShippingWrapper::~FullWalletShippingWrapper() {} |
| + |
| +bool FullWalletShippingWrapper::IsBillingWrapper() const { |
| + return false; |
| +} |
| + |
| } // namespace autofill |