OLD | NEW |
(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 |
OLD | NEW |