OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/autofill/content/browser/wallet/required_action.h" | 5 #include "components/autofill/content/browser/wallet/required_action.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 | 9 |
10 namespace autofill { | 10 namespace autofill { |
(...skipping 17 matching lines...) Expand all Loading... |
28 action == ACCEPT_TOS || | 28 action == ACCEPT_TOS || |
29 action == GAIA_AUTH || | 29 action == GAIA_AUTH || |
30 action == REQUIRE_PHONE_NUMBER || | 30 action == REQUIRE_PHONE_NUMBER || |
31 action == UPDATE_EXPIRATION_DATE || | 31 action == UPDATE_EXPIRATION_DATE || |
32 action == UPGRADE_MIN_ADDRESS || | 32 action == UPGRADE_MIN_ADDRESS || |
33 action == PASSIVE_GAIA_AUTH; | 33 action == PASSIVE_GAIA_AUTH; |
34 } | 34 } |
35 | 35 |
36 RequiredAction ParseRequiredActionFromString(const std::string& str) { | 36 RequiredAction ParseRequiredActionFromString(const std::string& str) { |
37 std::string str_lower; | 37 std::string str_lower; |
38 base::TrimWhitespaceASCII(base::StringToLowerASCII(str), base::TRIM_ALL, | 38 base::TrimWhitespaceASCII(base::ToLowerASCII(str), base::TRIM_ALL, |
39 &str_lower); | 39 &str_lower); |
40 | 40 |
41 if (str_lower == "setup_wallet") | 41 if (str_lower == "setup_wallet") |
42 return SETUP_WALLET; | 42 return SETUP_WALLET; |
43 else if (str_lower == "accept_tos") | 43 else if (str_lower == "accept_tos") |
44 return ACCEPT_TOS; | 44 return ACCEPT_TOS; |
45 else if (str_lower == "gaia_auth") | 45 else if (str_lower == "gaia_auth") |
46 return GAIA_AUTH; | 46 return GAIA_AUTH; |
47 else if (str_lower == "update_expiration_date") | 47 else if (str_lower == "update_expiration_date") |
48 return UPDATE_EXPIRATION_DATE; | 48 return UPDATE_EXPIRATION_DATE; |
49 else if (str_lower == "upgrade_min_address") | 49 else if (str_lower == "upgrade_min_address") |
50 return UPGRADE_MIN_ADDRESS; | 50 return UPGRADE_MIN_ADDRESS; |
51 else if (str_lower == "invalid_form_field") | 51 else if (str_lower == "invalid_form_field") |
52 return INVALID_FORM_FIELD; | 52 return INVALID_FORM_FIELD; |
53 else if (str_lower == "verify_cvv") | 53 else if (str_lower == "verify_cvv") |
54 return VERIFY_CVV; | 54 return VERIFY_CVV; |
55 else if (str_lower == "passive_gaia_auth") | 55 else if (str_lower == "passive_gaia_auth") |
56 return PASSIVE_GAIA_AUTH; | 56 return PASSIVE_GAIA_AUTH; |
57 else if (str_lower == "require_phone_number") | 57 else if (str_lower == "require_phone_number") |
58 return REQUIRE_PHONE_NUMBER; | 58 return REQUIRE_PHONE_NUMBER; |
59 else if (str_lower == "choose_another_instrument_or_address") | 59 else if (str_lower == "choose_another_instrument_or_address") |
60 return CHOOSE_ANOTHER_INSTRUMENT_OR_ADDRESS; | 60 return CHOOSE_ANOTHER_INSTRUMENT_OR_ADDRESS; |
61 | 61 |
62 DLOG(ERROR) << "Failed to parse: \"" << str << "\" as a required action"; | 62 DLOG(ERROR) << "Failed to parse: \"" << str << "\" as a required action"; |
63 return UNKNOWN_TYPE; | 63 return UNKNOWN_TYPE; |
64 } | 64 } |
65 | 65 |
66 } // namespace wallet | 66 } // namespace wallet |
67 } // namespace autofill | 67 } // namespace autofill |
OLD | NEW |