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

Unified Diff: chrome/browser/autofill/wallet/full_wallet.cc

Issue 11777007: Adds wallet::RequiredAction for when we start interacting with Online Wallet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ahutter@ review Created 7 years, 11 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
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..45589b39a31ccf1fa6fc3c32edbf49b13427f2d5 100644
--- a/chrome/browser/autofill/wallet/full_wallet.cc
+++ b/chrome/browser/autofill/wallet/full_wallet.cc
@@ -24,7 +24,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 +40,21 @@ 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))
+ 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)
+ if (required_actions.size() > 0) {
return scoped_ptr<FullWallet>(new FullWallet(-1,
-1,
"",
@@ -55,6 +62,7 @@ scoped_ptr<FullWallet>
scoped_ptr<Address>(),
scoped_ptr<Address>(),
required_actions));
+ }
} else {
DVLOG(1) << "Response from Google wallet missing required actions";
}
« no previous file with comments | « chrome/browser/autofill/wallet/full_wallet.h ('k') | chrome/browser/autofill/wallet/full_wallet_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698