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

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

Issue 12815002: requestAutocomplete: Fill |form_structure_| from Online Wallet data (including (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 9 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
« no previous file with comments | « chrome/browser/ui/autofill/data_model_wrapper.h ('k') | components/autofill/browser/wallet/full_wallet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..72661692e33fd773e4e509bc5de156ab914cd138 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,20 @@ 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);
+ }
+}
+
+void DataModelWrapper::FillFormField(AutofillField* field) {
+ field->value = GetInfo(field->type());
+}
+
+gfx::Image DataModelWrapper::GetIcon() {
+ return gfx::Image();
+}
+
// AutofillFormGroupWrapper
AutofillFormGroupWrapper::AutofillFormGroupWrapper(const FormGroup* form_group,
@@ -62,10 +77,6 @@ string16 AutofillFormGroupWrapper::GetInfo(AutofillFieldType type) {
return form_group_->GetInfo(type, AutofillCountry::ApplicationLocale());
}
-gfx::Image AutofillFormGroupWrapper::GetIcon() {
- return gfx::Image();
-}
-
void AutofillFormGroupWrapper::FillFormField(AutofillField* field) {
form_group_->FillFormField(*field, variant_, field);
}
@@ -101,14 +112,6 @@ gfx::Image AutofillCreditCardWrapper::GetIcon() {
return rb.GetImageNamed(card_->IconResourceId());
}
-void AutofillCreditCardWrapper::FillInputs(DetailInputs* inputs) {
- const std::string app_locale = AutofillCountry::ApplicationLocale();
- for (size_t j = 0; j < inputs->size(); ++j) {
- (*inputs)[j].autofilled_value =
- card_->GetInfo((*inputs)[j].type, app_locale);
- }
-}
-
string16 AutofillCreditCardWrapper::GetDisplayText() {
return card_->TypeAndLastFourDigits();
}
@@ -139,20 +142,6 @@ string16 WalletAddressWrapper::GetInfo(AutofillFieldType type) {
return address_->GetInfo(type);
}
-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());
-}
-
// WalletInstrumentWrapper
WalletInstrumentWrapper::WalletInstrumentWrapper(
@@ -180,8 +169,35 @@ string16 WalletInstrumentWrapper::GetDisplayText() {
return line1 + ASCIIToUTF16("\n") + DataModelWrapper::GetDisplayText();
}
-void WalletInstrumentWrapper::FillFormField(AutofillField* field) {
- field->value = GetInfo(field->type());
+// FullWalletBillingWrapper
+
+FullWalletBillingWrapper::FullWalletBillingWrapper(
+ wallet::FullWallet* full_wallet)
+ : full_wallet_(full_wallet) {
+ DCHECK(full_wallet_);
+}
+
+FullWalletBillingWrapper::~FullWalletBillingWrapper() {}
+
+string16 FullWalletBillingWrapper::GetInfo(AutofillFieldType type) {
+ if (AutofillType(type).group() == AutofillType::CREDIT_CARD)
+ return full_wallet_->GetInfo(type);
+
+ return full_wallet_->billing_address()->GetInfo(type);
+}
+
+// FullWalletShippingWrapper
+
+FullWalletShippingWrapper::FullWalletShippingWrapper(
+ wallet::FullWallet* full_wallet)
+ : full_wallet_(full_wallet) {
+ DCHECK(full_wallet_);
+}
+
+FullWalletShippingWrapper::~FullWalletShippingWrapper() {}
+
+string16 FullWalletShippingWrapper::GetInfo(AutofillFieldType type) {
+ return full_wallet_->shipping_address()->GetInfo(type);
}
} // namespace autofill
« no previous file with comments | « chrome/browser/ui/autofill/data_model_wrapper.h ('k') | components/autofill/browser/wallet/full_wallet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698