Chromium Code Reviews| Index: chrome/browser/autofill/wallet/full_wallet.cc |
| diff --git a/chrome/browser/autofill/wallet/full_wallet.cc b/chrome/browser/autofill/wallet/full_wallet.cc |
| index a163cffa2d0d48ef4b1efe105386d7a640f6fee4..c683d905c43a9ba637cba9c2c37a70c61dd2ab63 100644 |
| --- a/chrome/browser/autofill/wallet/full_wallet.cc |
| +++ b/chrome/browser/autofill/wallet/full_wallet.cc |
| @@ -7,6 +7,7 @@ |
| #include "base/logging.h" |
| #include "base/string_number_conversions.h" |
| #include "base/values.h" |
| +#include "chrome/browser/autofill/wallet/required_action.h" |
| namespace { |
| @@ -24,7 +25,7 @@ FullWallet::FullWallet(int expiration_month, |
| const std::string& encrypted_rest, |
| scoped_ptr<Address> billing_address, |
| scoped_ptr<Address> shipping_address, |
| - const std::vector<std::string>& required_actions) |
| + const std::vector<RequiredAction>& required_actions) |
| : expiration_month_(expiration_month), |
| expiration_year_(expiration_year), |
| iin_(iin), |
| @@ -40,14 +41,17 @@ FullWallet::~FullWallet() {} |
| scoped_ptr<FullWallet> |
| FullWallet::CreateFullWallet(const DictionaryValue& dictionary) { |
| const ListValue* required_actions_list; |
| - std::vector<std::string> required_actions; |
| + 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; |
| - if (required_actions_list->GetString(i, &action)) |
| - required_actions.push_back(action); |
| + std::string action_string; |
| + if (required_actions_list->GetString(i, &action_string)) { |
| + RequiredAction action(RequiredAction::ParseFromString(action_string)); |
|
Ilya Sherman
2013/01/05 03:15:06
Add a DCHECK that the parse succeeded?
Dan Beam
2013/01/05 03:17:38
If the parse didn't succeed (and the type ends up
Ilya Sherman
2013/01/05 03:32:58
Hmm, I guess DCHECKs make testing suck. Ok, never
|
| + if (action.AppliesToFullWallet()) |
| + required_actions.push_back(action); |
| + } |
| } |
| - if (required_actions.size() > 0) |
| + if (required_actions.size() > 0) { |
| return scoped_ptr<FullWallet>(new FullWallet(-1, |
| -1, |
| "", |
| @@ -55,6 +59,7 @@ scoped_ptr<FullWallet> |
| scoped_ptr<Address>(), |
| scoped_ptr<Address>(), |
| required_actions)); |
| + } |
| } else { |
| DVLOG(1) << "Response from Google wallet missing required actions"; |
| } |