Index: components/autofill/content/browser/wallet/full_wallet.cc |
diff --git a/components/autofill/content/browser/wallet/full_wallet.cc b/components/autofill/content/browser/wallet/full_wallet.cc |
index d27a14ab35f7b73dc9fce69616ca6cc60ab9a215..65bc79881d2964c751556f9742a8478f069adf17 100644 |
--- a/components/autofill/content/browser/wallet/full_wallet.cc |
+++ b/components/autofill/content/browser/wallet/full_wallet.cc |
@@ -28,108 +28,20 @@ FullWallet::FullWallet(int expiration_month, |
const std::string& iin, |
const std::string& encrypted_rest, |
scoped_ptr<Address> billing_address, |
- scoped_ptr<Address> shipping_address, |
- const std::vector<RequiredAction>& required_actions) |
+ scoped_ptr<Address> shipping_address) |
: expiration_month_(expiration_month), |
expiration_year_(expiration_year), |
iin_(iin), |
encrypted_rest_(encrypted_rest), |
billing_address_(billing_address.Pass()), |
- shipping_address_(shipping_address.Pass()), |
- required_actions_(required_actions) { |
- DCHECK(required_actions_.size() > 0 || billing_address_.get()); |
+ shipping_address_(shipping_address.Pass()) { |
+ DCHECK(billing_address_.get()); |
} |
FullWallet::~FullWallet() {} |
// static |
scoped_ptr<FullWallet> |
- FullWallet::CreateFullWallet(const base::DictionaryValue& dictionary) { |
- const base::ListValue* required_actions_list; |
- std::vector<RequiredAction> required_actions; |
- if (dictionary.GetList("required_action", &required_actions_list)) { |
- for (size_t i = 0; i < required_actions_list->GetSize(); ++i) { |
- std::string action_string; |
- if (required_actions_list->GetString(i, &action_string)) { |
- RequiredAction action = ParseRequiredActionFromString(action_string); |
- if (!ActionAppliesToFullWallet(action)) { |
- DLOG(ERROR) << "Response from Google wallet with bad required action:" |
- " \"" << action_string << "\""; |
- return scoped_ptr<FullWallet>(); |
- } |
- required_actions.push_back(action); |
- } |
- } |
- if (required_actions.size() > 0) { |
- return scoped_ptr<FullWallet>(new FullWallet(-1, |
- -1, |
- std::string(), |
- std::string(), |
- scoped_ptr<Address>(), |
- scoped_ptr<Address>(), |
- required_actions)); |
- } |
- } else { |
- DVLOG(1) << "Response from Google wallet missing required actions"; |
- } |
- |
- int expiration_month; |
- if (!dictionary.GetInteger("expiration_month", &expiration_month)) { |
- DLOG(ERROR) << "Response from Google wallet missing expiration month"; |
- return scoped_ptr<FullWallet>(); |
- } |
- |
- int expiration_year; |
- if (!dictionary.GetInteger("expiration_year", &expiration_year)) { |
- DLOG(ERROR) << "Response from Google wallet missing expiration year"; |
- return scoped_ptr<FullWallet>(); |
- } |
- |
- std::string iin; |
- if (!dictionary.GetString("iin", &iin)) { |
- DLOG(ERROR) << "Response from Google wallet missing iin"; |
- return scoped_ptr<FullWallet>(); |
- } |
- |
- std::string encrypted_rest; |
- if (!dictionary.GetString("rest", &encrypted_rest)) { |
- DLOG(ERROR) << "Response from Google wallet missing rest"; |
- return scoped_ptr<FullWallet>(); |
- } |
- |
- const base::DictionaryValue* billing_address_dict; |
- if (!dictionary.GetDictionary("billing_address", &billing_address_dict)) { |
- DLOG(ERROR) << "Response from Google wallet missing billing address"; |
- return scoped_ptr<FullWallet>(); |
- } |
- |
- scoped_ptr<Address> billing_address = |
- Address::CreateAddress(*billing_address_dict); |
- if (!billing_address.get()) { |
- DLOG(ERROR) << "Response from Google wallet has malformed billing address"; |
- return scoped_ptr<FullWallet>(); |
- } |
- |
- const base::DictionaryValue* shipping_address_dict; |
- scoped_ptr<Address> shipping_address; |
- if (dictionary.GetDictionary("shipping_address", &shipping_address_dict)) { |
- shipping_address = |
- Address::CreateAddressWithID(*shipping_address_dict); |
- } else { |
- DVLOG(1) << "Response from Google wallet missing shipping address"; |
- } |
- |
- return scoped_ptr<FullWallet>(new FullWallet(expiration_month, |
- expiration_year, |
- iin, |
- encrypted_rest, |
- billing_address.Pass(), |
- shipping_address.Pass(), |
- required_actions)); |
-} |
- |
-// static |
-scoped_ptr<FullWallet> |
FullWallet::CreateFullWalletFromClearText( |
int expiration_month, |
int expiration_year, |
@@ -142,13 +54,10 @@ scoped_ptr<FullWallet> |
DCHECK(!cvn.empty()); |
scoped_ptr<FullWallet> wallet(new FullWallet( |
- expiration_month, |
- expiration_year, |
+ expiration_month, expiration_year, |
std::string(), // no iin -- clear text pan/cvn are set below. |
std::string(), // no encrypted_rest -- clear text pan/cvn are set below. |
- billing_address.Pass(), |
- shipping_address.Pass(), |
- std::vector<RequiredAction>())); // no required actions in clear text. |
+ billing_address.Pass(), shipping_address.Pass())); |
wallet->pan_ = pan; |
wallet->cvn_ = cvn; |
return wallet.Pass(); |
@@ -218,13 +127,6 @@ base::string16 FullWallet::GetInfo(const std::string& app_locale, |
} |
} |
-bool FullWallet::HasRequiredAction(RequiredAction action) const { |
- DCHECK(ActionAppliesToFullWallet(action)); |
- return std::find(required_actions_.begin(), |
- required_actions_.end(), |
- action) != required_actions_.end(); |
-} |
- |
base::string16 FullWallet::TypeAndLastFourDigits() { |
CreditCard card; |
card.SetRawInfo(CREDIT_CARD_NUMBER, base::ASCIIToUTF16(GetPan())); |
@@ -264,9 +166,6 @@ bool FullWallet::operator==(const FullWallet& other) const { |
return false; |
} |
- if (required_actions_ != other.required_actions_) |
- return false; |
- |
return true; |
} |