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

Side by Side Diff: chrome/browser/autofill/wallet/required_action.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/autofill/wallet/required_action.h"
6
7 #include "base/logging.h"
8 #include "base/string_util.h"
9
10 namespace wallet {
11
12 bool ActionAppliesToFullWallet(RequiredAction action) {
13 return action == UPDATE_EXPIRATION_DATE ||
14 action == UPGRADE_MIN_ADDRESS ||
15 action == INVALID_FORM_FIELD ||
16 action == CVC_RISK_CHALLENGE;
17 }
18
19 bool ActionAppliesToWalletItems(RequiredAction action) {
20 return action == SETUP_WALLET ||
21 action == ACCEPT_TOS ||
22 action == GAIA_AUTH ||
23 action == INVALID_FORM_FIELD;
24 }
25
26 RequiredAction ParseRequiredActionFromString(const std::string& str) {
27 std::string str_lower;
28 TrimWhitespaceASCII(StringToLowerASCII(str), TRIM_ALL, &str_lower);
29
30 if (str_lower == "setup_wallet")
31 return SETUP_WALLET;
32 else if (str_lower == "accept_tos")
33 return ACCEPT_TOS;
34 else if (str_lower == "gaia_auth")
35 return GAIA_AUTH;
36 else if (str_lower == "update_expiration_date")
37 return UPDATE_EXPIRATION_DATE;
38 else if (str_lower == "upgrade_min_address")
39 return UPGRADE_MIN_ADDRESS;
40 else if (str_lower == "invalid_form_field")
41 return INVALID_FORM_FIELD;
42 else if (str_lower == "cvc_risk_challenge")
43 return CVC_RISK_CHALLENGE;
44
45 DLOG(ERROR) << "Failed to parse: \"" << str << "\" as a required action";
46 return UNKNOWN_TYPE;
47 }
48
49 } // namespace wallet
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698